由于计算机未联网,而利用 epicsarchiverap-env 工具进行安装的过程中需要一些联网下载安装包的操作步骤,因此以下会给出相应的解决方法。
总体思路就是:
对于一般性网址如 GitHub 等,提前下载好安装包并 U 盘拷贝到计算机上;
对于系统镜像中具备的依赖包,通过跳板机和对yum源的设置,从 192.168.206.234:8888 服务器上获取安装包(详见在未联网的计算机中部署 yum 源和 EPICS 环境)。
1. 提前下载好相关的包并 U 盘拷贝到工作站
【epicsarchiverap-env-1.2.0.tar.gz】 https://github.com/jeonghanlee/epicsarchiverap-env
这是一个用来安装 Archiver Appliance 的懒人安装工具
【epicsarchiverap-1.1.0.zip】 https://github.com/slacmshankar/epicsarchiverap
Archiver Appliance 的安装包
【apache-tomcat-9.0.65.tar.gz】 https://archive.apache.org/dist/tomcat/
注意,此处版本号应和 epicsarchiverap-env/configure/CONFIG_TOMCAT文件中定义的 TOMCAT_MAJOR_VER 和 TOMCAT_MINOR_VER一致。
【svg_viewer-66e9473943991ff5cf9a786e7b51aa95605f508e.zip】 https://github.com/slacmshankar/svg_viewer
retrieval 相关的web页面文件。直接下载的epicsarchiverap/svg_viewer/下为空。
2. 安装
根据 Archiver Appliance for ONLY Rocky 8 的指导,并结合未联网情况来进行安装。
2.1 将安装包放在合适位置(取代 make init)
tar -zxf epicsarchiverap-env-1.2.0.tar.gz /home/user/modules
tar -zxf epicsarchiverap-master.zip epicsarchiverap-env-1.2.0/epicsarchiverap-src
cp apache-tomcat-9.0.65.tar.gz epicsarchiverap-env-1.2.0/
tar -zxf svg_viewer-66e9473943991ff5cf9a786e7b51aa95605f508e.zip epicsarchiverap-env-1.2.0/epicsarchiverap-src/svg_viewer
2.2 安装依赖包(取代 make install.pkgs)
cd epicsarchiverap-env-1.2.0
sudo dnf install -y gcc libgcc wget sudo git unzip curl make tree sed which java-11-openjdk ant mariadb-server chrony
su
echo 1 | update-alternatives --config java # 选择Java默认版本,只能以root身份执行
su user
暂时不需要安装 epel-release 和启动 powertools 软件仓库。
Enable PowerTools Repository on Rocky Linux 8
2.3 启动数据库服务
sudo systemctl start mariadb
sudo systemctl status mariadb
2.4 创建关于 Archiver Appliance 的数据库用户和表
make db.secure
make db.addAdmin # 添加 admin 用户
make db.show # 以 admin 用户显示 databases
make db.create # 创建 archappl 用户和数据库
make db.show
通过mysql --version
命令可以查看mariadb版本。
我们通过yum安装的mariadb的版本是5.5.68,因此需做一些设置:
mysql -uroot
MariaDB [(none)]> set global innodb_large_prefix=1;
MariaDB [(none)]> set global innodb_file_format=BARRACUDA;
MariaDB [(none)]> set global innodb_file_per_table=true;
给每个CREATE TABLE的语句末尾、ENGINE=InnoDB之前加上ROW_FORMAT=DYNAMIC:
vi epicsarchiverap-src/src/main/org/epics/archiverappliance/config/persistence/archappl_mysql.sql
继续执行:
make sql.fill # 在 archappl 数据库中创建 Archiver Appliance 的 4 个 table
make sql.show # 显示 Archiver Appliance 的 4 个 table
2.5 个性化定制
修改epicsarchiverap-env/site-template/siteid/template_changes.html文件:
<span id="siteimages"><a href="http://web.ihep.ac.cn/"><img src="comm/img/IHEPLogo.jpg" height="96px"></img></a></span>
<link rel="icon" type="image/png" href="comm/img/ihep.ico" />
<p>This is the Institute of High Energy Physics of Chinese Academy of Sciences(IHEP) customized EPICS Archiver Appliance. If one has technical issues, please contact dongxuewei@ihep.ac.cn or at <a href="https://github.com/slacmshankar/epicsarchiverap/issues">the EPICS Archiver Appliance Issues</a> directly. </p>
修改epicsarchiverap-env/site-template/siteid/css/main.css和mgmt.css,来调整页面样式:
.pageheader {
height: 96px;
}
.apptitle {
padding-left: 0.1em;
padding-top: 0.6em;
……
color: #00313C;
font-size: 3em;
…….
}
#siteimages{
float: right;
height: 96px;
}
修改epicsarchiverap-env/site-template/siteid/build.xml文件:
把其中的Advanced Light Source (ALS-U)改为Institute of High Energy Physics of Chinese Academy of Sciences(IHEP);
ALS改为IHEP;
als改为ihep
sed -i "s/Advanced Light Source (ALS-U)/Institute of High Energy Physics of Chinese Academy of Sciences(IHEP)/g" build.xml
sed -i "s/ALS/IHEP/g" build.xml
sed -i "s/als/ihep/g" build.xml
将IHEPLogo.jpg、ihep.ico图片复制到site-template/siteid/img/下
在epicsarchiverap-env/下执行make build及后续步骤
2.6 配置 Java、tomcat 相关的环境变量
make rocky8.conf
2.7 将 tomcat 安装到/opt/tomcat9/下,并做一些配置修改(取代make tomcat)
make tomcat.install # 创建 tomcat:tomcat 用户、组;解压安装包到/opt/tomcat9/下;更改文件权限等
make tomcat.update # 更改服务端口配置
2.8 创建 4 个 war 包和一个 tar.gz 压缩包到 epicsarchiverap-env/wars/下
make build # 包含个性化定制
2.9 将 Archiver Appliance 的 4 个 war 包及相关配置文件安装到/opt/epicsarchiverap/下,并部署成 system service
make install
确认安装完成:
make exist
2.10 启动 Archiver Appliance 系统服务
make sd_start
make sd_status
2.11 打开 Archiver Appliance 自带 web 界面
http://localhost:17665/mgmt/
或
http://localhost:17665/mgmt/ui/index.html
3. 安装和使用过程中遇到的问题
-
权限问题
当设置了PV存储路径为非 /arch 下的其他路径时,archappl_service.log 中有可能报错如下:113367 [MgmtArchivePVWorkflow1] WARN edu.stanford.slac.archiverappliance.PlainPB.PlainPBStoragePlugin - Plain PB plugin: The root folder specified does not exist - /home/user/arch/mts/ArchiverStore. Creating it 113368 [MgmtArchivePVWorkflow1] ERROR org.epics.archiverappliance.mgmt.archivepv.CapacityPlanningBPL - Exception during capacity planning, returning this appliance java.nio.file.AccessDeniedException: /home/user/arch/mts at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90)
这是因为 epicsarchiverap.service 系统服务默认的运行用户为 tomcat:
[Service] # User=tomcat Group=tomcat #
而 tomcat 用户没有进入 /home/user 目录的权限。
解决方式:将该系统服务的运行用户改为 root,则可以任意设置 PV 的存储路径。
-
mariadb版本问题
若mariadb版本低于5.7,且make sql.fill
之前按前述步骤对mariadb进行设置,则会报错“Specified key was too long; max key length is 767 bytes”。5.6版本的innodb大长度前缀默认是关闭的,而5.7之后大文件前缀默认是开启的。
MySQL 建索引时遇到 Specified key was too long; max key length is 767 bytes
MySQL 经典案例分析:Specified key was too long
mysql字符集 utf8 和utf8mb4 的区别