171环境部署过程
背景缺少稳定环境180为开发dev环境,需要171搭建起来成为稳定环境
地址:http://10.240.70.171
主要步骤
1.数据库安装
2.Apache安装
3.创建目录
4.防火墙设置
5.部署应用
6.修改配置文件
数据库安装
PostgreSQL是以加州大学伯克利分校计算机系开发的 POSTGRES,现在已经更名为PostgreSQL,版本 4.2为基础的对象关系型数据库管理系统(ORDBMS)。PostgreSQL支持大部分 SQL标准并且提供了许多其他现代特性:复杂查询、外键、触发器、视图、事务完整性、MVCC。同样,PostgreSQL 可以用许多方法扩展,比如, 通过增加新的数据类型、函数、操作符、聚集函数、索引。免费使用、修改、和分发 PostgreSQL,不管是私用、商用、还是学术研究使用。
参考文档:
https://blog.csdn.net/ifucking/article/details/80005241 --PostgreSQL一些常用命令
https://blog.csdn.net/u010856284/article/details/70142810
安装文档:
https://blog.csdn.net/qq_21383435/article/details/79444778
(问题:
1.怎么查看数据库安装在哪里,文档中提供的命令找不到;)
[root@rhel-70171 bin]# su postgres --切换账户
[postgres@rhel-70171 SPN_DB]$ pwd
/home/pgsql/SPN_DB
[postgres@rhel-70171 SPN_DB]$ ls
data drop_db.sql install_db.sh set_env.sh setup_db.sql temp uninstall_db.sh
[root@rhel-70171 opt]#ps -ef|grep postgres --查看进程 数据库已经安装完成
root 7246 7210 0 11:24 pts/1 00:00:00 grep --color=auto postgres
Apache安装
Apache HTTP Server(简称Apache)是Apache软件基金会的一个开放源码的网页服务器,可以在大多数计算机操作系统中运行,由于其多平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩展,将Perl/Python等解释器编译到服务器中
[root@rhel-70171 SPN_all]# yum search httpd --查看Apache最新版本1
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
===================================================================================== N/S matched: httpd ======================================================================================
httpd.x86_64 : Apache HTTP Server --最新版本号
httpd-devel.x86_64 : Development interfaces for the Apache HTTP server
[root@rhel-70171 SPN_all]# yum -y install httpd.x86_64 --安装2
[root@rhel-70171 WEB]# cd /etc/httpd/conf
[root@rhel-70171 conf]# ll
total 28
-rw-r--r--. 1 root root 11753 Mar 20 2014 httpd.conf
-rw-r--r--. 1 root root 13077 Mar 20 2014 magic
[root@rhel-70171 conf]# cp httpd.conf httpd.conf_bak --备份httpd的篇日志3
[root@rhel-70171 conf]# ll
total 40
-rw-r--r--. 1 root root 11753 Mar 20 2014 httpd.conf
-rw-r--r--. 1 root root 11753 Apr 19 14:20 httpd.conf_bak
-rw-r--r--. 1 root root 13077 Mar 20 2014 magic
[root@rhel-70171 conf]# systemctl reload httpd --加载4
[root@rhel-70171 conf]# systemctl restart httpd --重启5
创建目录
[root@rhel-70171 ~]# cd /opt
[root@rhel-70171 SPN_all]# mkdir SPN_all --SPN目录
[root@rhel-70171 SPN_all]# mkdir ODL --后端目录
[root@rhel-70171 SPN_all]# mkdir WEB --前端目录
[root@rhel-70171 SPN_all]# ll
total 0
drwxr-xr-x. 2 root root 6 Apr 19 14:02 ODL
drwxr-xr-x. 2 root root 6 Apr 19 14:02 WEB
关闭防火墙
[root@rhel-70171 SPN_all]#systemctl status firewalld --查看防火墙状态
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: active (running)since Mon 2018-09-03 16:26:11 CST; 7 months 14 days ago
Main PID: 28384 (firewalld)
CGroup: /system.slice/firewalld.service
└─28384 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
[root@rhel-70171 SPN_all]#systemctl stop firewalld --关闭防火墙
[root@rhel-70171 SPN_all]#systemctl status firewalld --查看防火墙状态
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)
Active: inactive (dead)since Fri 2019-04-19 14:07:27 CST; 24s ago
Main PID: 28384 (code=exited, status=0/SUCCESS)
PS:关闭防火墙为可选操作,也可以添加80端口到配置
解压安装包
ODL
[root@rhel-70171 SPN_all]# cd ODL/
[root@rhel-70171 ODL]# ll
total 286024
-rw-r--r--. 1 root root 292887237 Apr 19 14:12 ut-platform-dvm_BE_v1.0.0.1_190419.zip
[root@rhel-70171 ODL]#unzip -oq ut-platform-dvm_BE_v1.0.0.1_190419.zip --解压
-o 不 必先询问用户,unzip执 行后覆盖原有文件。
-q 执 行时不显示任何信息。
unzip详解:https://happyqing.iteye.com/blog/1739909
[root@rhel-70171 ODL]# ll
total 286060
drwxr-xr-x. 3 root root 4096 Jan 18 10:22 bin
drwxr-xr-x. 2 root root 4096 Apr 19 10:08 configuration
drwxr-xr-x. 3 root root 16 Apr 19 10:07 data
drwxr-xr-x. 2 root root 19 Apr 19 10:07 deploy
drwxr-xr-x. 3 root root 4096 Apr 19 10:08 etc
drwxr-xr-x. 5 root root 4096 Apr 19 10:08 jre1.8-linux
drwxr-xr-x. 5 root root 86 Jan 18 10:22 lib
-rw-r--r--. 1 root root 11266 Jan 18 10:21 LICENSE
drwxr-xr-x. 5 root root 39 Apr 19 10:08 spec
drwxr-xr-x. 26 root root 4096 Apr 19 10:08 system
-rw-r--r--. 1 root root 292887237 Apr 19 14:12 ut-platform-dvm_BE_v1.0.0.1_190419.zip
-rw-r--r--. 1 root root 99 Apr 19 10:13 version.properties
WEB
[root@rhel-70171 SPN_all]# ll
total 4
drwxr-xr-x. 11 root root 4096 Apr 19 14:12 ODL
drwxr-xr-x. 2 root root 54 Apr 19 14:12 WEB
[root@rhel-70171 SPN_all]# cd WEB/
[root@rhel-70171 WEB]# ll
total 7156
-rw-r--r--. 1 root root 7324566 Apr 19 14:12 SPN_Merge_Common_FE_v1.0.0.1_20190419.zip
[root@rhel-70171 WEB]#unzip SPN_Merge_Common_FE_v1.0.0.1_20190419.zip --不带参数直接解压,解压过程会显示解压的文件
Archive: SPN_Merge_Common_FE_v1.0.0.1_20190419.zip
修改配置文件
修改文件systemConfig.js
把180替换成171
[root@rhel-70171 WEB]# pwd
/opt/SPN_all/WEB
[root@rhel-70171 WEB]#vi systemConfig.js
let host = window.location.host;
let systemConfig = {
odlConfig: {
baseURL: 'http://10.240.70.180:8181/',
//baseURL: 'http://' + host + ':8181/',
timeout: 90000,
headers: {
// 'X-Auth-Token': 'f2b6637ddf355a476918940289c0be016a4fe99e3b69c83d',
'Content-Type': 'application/json',
'Accept':'application/json'
//'Authorization': 'Basic YWRtaW46YWRtaW4='
},
//validateStatus返回false时拦截器内error是报错的堆栈对象而不是含有data的error对象
validateStatus: function(status) {
return status <= 600; // Reject only if the status code is greater than or equal to 500
},
responseType: 'json',
// withCredentials: true,
},
webSocketConfig: {
baseURL: 'ws://10.240.70.180:8188',
urlPlatform: 'ws://10.240.70.180:8089',
binaryType: 'arraybuffer',
},
demoConfig: {
baseURL: "http://127.0.0.1:8085/",
timeout: 90000,
headers: {
// 'X-Auth-Token': 'f2b6637ddf355a476918940289c0be016a4fe99e3b69c83d',
"Content-Type": "application/json",
Accept: "application/json"
//'Authorization': 'Basic YWRtaW46YWRtaW4='
},
//validateStatus返回false时拦截器内error是报错的堆栈对象而不是含有data的error对象
validateStatus: function(status) {
return status <= 600; // Reject only if the status code is greater than or equal to 500
},
responseType: "json"
// withCredentials: true,
vhost.conf 修改
/etc/httpd/conf.d/vhost.conf
[root@rhel-70171 conf]# cd /etc/httpd/conf.d/
[root@rhel-70171 conf.d]# ls
autoindex.conf README userdir.conf vhost.conf welcome.conf
[root@rhel-70171 conf.d]# cat vhost.conf
Listen 80
#Listen 8088
Options Indexes MultiViews FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
ServerAdmin [email protected]
DocumentRoot/opt/SPN_all/WEB --修改根目录
ServerName10.240.70.171:80 --修改serverName
ErrorLog logs/spn-all-error_log
CustomLog logs/spn-all-access_log common
httpd.conf 修改
参考文档:
https://blog.csdn.net/u010433704/article/details/51296326
https://www.jianshu.com/p/687b915766b6
/etc/httpd/conf/httpd.conf --把80端口监听注释
DocumentRoot --在conf中注释定义web目录
在conf中注释了 servername
定义了Apache的根节点
ServerRoot "/etc/httpd"
定义了Apache的errorlog目录loglevel
ErrorLog "logs/error_log"
[root@rhel-70171 logs]# pwd
/etc/httpd/logs
LogLevel warn
定义了ServerRoot用于指定守护进程httpd的运行目录
ServerRoot "/etc/httpd"
问题:
1.DocumentRoot注释了为啥下面的directory为啥不注释;
2.什么要在这里吧servername和VirtualHost在这里注释掉,在conf中其实也可以实现配置多个端口
3.在这里定义后端ODL的路径
数据库配置
/opt/SPN_all/ODL/configuration --路径
[root@rhel-70171 configuration]# cat db.properties
#osgi.jdbc.driver.class=org.postgresql.Driver
#osgi.jdbc.driver.name = postgresql
url=jdbc:postgresql://10.240.70.171:5432/spndb?characterEncoding=utf-8
user=postgres
password=postgres
#dbcp settings
[root@rhel-70171 configuration]# pwd
其它
log查看
[root@rhel-70171 log]# pwd
/opt/SPN_all/ODL/data/log
[root@rhel-70171 bin]#tail -f ../data/log/karaf.log --查看后端log
[root@rhel-70171 logs]# ls
access_log error_log spn-all-access_log spn-all-error_log--查看Apache的相关log
[root@rhel-70171 logs]# pwd
/etc/httpd/logs
杀进程
[root@rhel-70171 bin]# pwd
/opt/SPN_all/ODL/bin
[root@rhel-70171 bin]# cat java_kill.sh
ps -ef|grep java
kill -9 $(pgrep java)
ps -ef|grep java
[root@rhel-70171 bin]#./java_kill.sh --执行杀进程脚本
清除数据库缓存
[root@rhel-70171 bin]#./remove_cache.sh --清除
[root@rhel-70171 bin]# cat remove_cache.sh
cd ..
rm -rf cache data instances journal snapshots idmlight.db.mv.db lock
[root@rhel-70171 bin]# pwd
/opt/SPN_all/ODL/bin
systemctl介绍
https://www.cnblogs.com/lxjshuju/p/7183689.html --systemctl介绍