美文网首页
Red Hat 7.x 配置ArcGIS Enterprise开

Red Hat 7.x 配置ArcGIS Enterprise开

作者: Xuds | 来源:发表于2018-11-19 13:43 被阅读0次

    前言

    要想在Red Hat 7.x上配置ArcGIS Datastore、ArcGIS Server、Portal for ArcGIS、WebAdaptor所在的tomcat自动启动,和之前的版本是不同的。在7之前的版本,参考教程为:

    1. 在Linux环境下设置ArcGIS的 Server,Portal和DataStore服务开机自启
    2. Linux下Tomcat开机自启

    绝对不要尝试在Red Hat 7.x上使用RedHat6.8上的实施方案。

    一、Portal, Server, Datastore 开机启动

    在开始之前,默认您已经按照Linux上安装ArcGIS Enterprise超详细教程——以Redhat7.2上安装ArcGIS Enterprise 10.5为例的步骤将ArcGIS Enterprise安装完毕。

    1.拷贝

    用root用户登录
    将 <Portal for ArcGIS installation directory>/framework/etc/arcgisportal.service 服务注册文件复制到 /etc/systemd/system
    将 <ArcGIS Server 安装目录>/framework/etc/scripts/arcgisserver.service 单元文件复制到 /etc/systemd/system
    将 <ArcGIS Data Store installation directory>/framework/etc/scripts/arcgisdatastore.service 复制到 /etc/systemd/system

    具体命令:

    cp /home/arcgis/arcgis/server/framework/etc/scripts/arcgisserver.service /etc/systemd/system/arcgisserver.service
    cp /home/arcgis/arcgis/arcgisportal/framework/etc/arcgisportal.service /etc/systemd/system/arcgisserver.service
    cp /home/arcgis/arcgis/arcgisdatastore/framework/etc/arcgisportal.service /etc/systemd/system/arcgisserver.service
    

    2.修改权限

    文件复制完成后,请确保将其文件权限设置为 600。

    chmod -R 600 /etc/systemd/system/arcgisserver.service
    chmod -R 600 /etc/systemd/system/arcgisportal.service
    chmod -R 600 /etc/systemd/system/arcgisdatastore.service
    

    3.配置启动

    仍然以root用户的身份运行以下命令,以在 /etc/systemd/system/multi-user.target.wants 中自动创建链接:

    systemctl enable arcgisportal.service
    systemctl enable arcgisserver.service
    systemctl enable arcgisdatastore.service
    

    4.如果想要验证是否配置正确

    先停止了以上的产品。例如各产品安装目录下的./stopxxx
    利用systemd 重新启动服务后检查其状态。以ArcGIS Server为例

    systemctl stop arcgisserver.service
    systemctl start arcgisserver.service
    systemctl status arcgisserver.service
    

    可以重启此服务器进行测试。看Server Datastore Portal服务能否起来。

    reboot
    

    二、Tomcat自动启动

    同样的,默认您已经按照Linux上安装ArcGIS Enterprise超详细教程——以Redhat7.2上安装ArcGIS Enterprise 10.5为例的步骤将ArcGIS Enterprise安装完毕。Linux版的ArcGIS WebAdaptor 是运行在tomcat 容器里的。所以设置了tomcat开机自动启动也就实现了WebAdaptor开机自动启动。
    使用root用户

    1.创建pid文件

    在tomcat目录下新建一个空文件tomcat.pid 命令如下

    cd /home/tomcat8
    vi tomcat.pid
    :wq!
    

    2.设置tomcat记录pid

    在/home/tomcat8/bin目录下新建setenv.sh(catalina.sh调用)

    cd /home/tomcat8/bin
    vi setenv.sh
    $CATALINA_BASE为tomcat安装的目录路径,将tomcat.pid指给了CATALINA_PID
    CATALINA_PID="$CATALINA_BASE/tomcat.pid"
    :wq
    

    CATALINA_PID 是个变量,在tomcat启动的时候会写入值到tomcat.pid

    3.增加systemctl的tomcat服务

    在/etc/systemd/system/目录下增加tomcat.service,目录必须是绝对目录。

    cd /etc/systemd/system
    vi /tomcat.service
    [Unit]
    Description=Apache Tomcat 8
    After=syslog.target network.target
     
    [Service]
    Type=forking
    PIDFile=/home/tomcat8/tomcat.pid
    ExecStart=/home/tomcat8/bin/startup.sh 
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true
    
    [Install]
    WantedBy=multi-user.target
    :wq
    

    设置600权限

    chmod -R 600 /etc/systemd/system/tomcat.service
    

    4.配置开机启动

    systemctl enable tomcat
    

    5.测试启动tomcat失败

    启动tomcat

    systemctl start tomcat
    得到报错为
    Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
    查看错误信息
    systemctl status tomcat
    ● tomcat.service - Tomcat  
       Loaded: loaded (/usr/lib/systemd/system/tomcat.service; enabled; vendor preset: disabled)  
       Active: failed (Result: exit-code) since 五 2016-12-16 17:52:49 CST; 5s ago  
      Process: 34944 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=1/FAILURE)  
      Process: 34953 ExecStart=/usr/local/apache-tomcat-8.5.6/bin/startup.sh (code=exited, status=1/FAILURE)  
     Main PID: 34899 (code=exited, status=0/SUCCESS)  
      
    12月 16 17:52:49 klmy-460-res01 systemd[1]: Starting Tomcat...  
    12月 16 17:52:49 klmy-460-res01 startup.sh[34953]: Neither the JAVA_HOME nor the JRE_HOME environment varia...ined  
    12月 16 17:52:49 klmy-460-res01 startup.sh[34953]: At least one of these environment variable is needed to ...gram  
    12月 16 17:52:49 klmy-460-res01 systemd[1]: tomcat.service: control process exited, code=exited status=1  
    12月 16 17:52:49 klmy-460-res01 systemd[1]: Failed to start Tomcat.  
    12月 16 17:52:49 klmy-460-res01 systemd[1]: Unit tomcat.service entered failed state.  
    12月 16 17:52:49 klmy-460-res01 systemd[1]: tomcat.service failed.  
    Hint: Some lines were ellipsized, use -l to show in full.  
    

    可以看到失败的原因是 读不到环境变量

    startup.sh[34953]: Neither the JAVA_HOME nor the JRE_HOME environment varia...ined  
    startup.sh[34953]: At least one of these environment variable is needed to ...gram  
    

    而经过检查JAVA_HOME 和JRE_HOME都是正常的。只能强行在catalina.sh里写入环境变量。
    切换到tomcat bin目录下

    cd /home/tomcat/bin
    vi catalina.sh
    export JAVA_HOME=/home/jdk8
    export JRE_HOME=/home/jdk8/jre  
    

    再执行

    systemctl start tomcat
    systemctl status tomcat
    

    成功。
    可以重启此服务器进行测试。看tomcat服务能否起来。

    reboot
    

    相关文章

      网友评论

          本文标题:Red Hat 7.x 配置ArcGIS Enterprise开

          本文链接:https://www.haomeiwen.com/subject/epldfqtx.html