171環(huán)境部署過(guò)程
背景缺少穩(wěn)定環(huán)境180為開(kāi)發(fā)dev環(huán)境,需要171搭建起來(lái)成為穩(wěn)定環(huán)境
主要步驟
1.數(shù)據(jù)庫(kù)安裝
2.Apache安裝
3.創(chuàng)建目錄
4.防火墻設(shè)置
5.部署應(yīng)用
6.修改配置文件
數(shù)據(jù)庫(kù)安裝
PostgreSQL是以加州大學(xué)伯克利分校計(jì)算機(jī)系開(kāi)發(fā)的 POSTGRES,現(xiàn)在已經(jīng)更名為PostgreSQL,版本 4.2為基礎(chǔ)的對(duì)象關(guān)系型數(shù)據(jù)庫(kù)管理系統(tǒng)(ORDBMS)。PostgreSQL支持大部分 SQL標(biāo)準(zhǔn)并且提供了許多其他現(xiàn)代特性:復(fù)雜查詢、外鍵、觸發(fā)器、視圖、事務(wù)完整性、MVCC。同樣,PostgreSQL 可以用許多方法擴(kuò)展,比如, 通過(guò)增加新的數(shù)據(jù)類型、函數(shù)、操作符、聚集函數(shù)、索引。免費(fèi)使用、修改、和分發(fā) PostgreSQL,不管是私用、商用、還是學(xué)術(shù)研究使用。
參考文檔:
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
(問(wèn)題:
1.怎么查看數(shù)據(jù)庫(kù)安裝在哪里,文檔中提供的命令找不到;)
[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 --查看進(jìn)程 數(shù)據(jù)庫(kù)已經(jīng)安裝完成
root? ? ? 7246? 7210? 0 11:24 pts/1? ? 00:00:00 grep --color=auto postgres
Apache安裝
Apache HTTP?Server(簡(jiǎn)稱Apache)是Apache軟件基金會(huì)的一個(gè)開(kāi)放源碼的網(wǎng)頁(yè)服務(wù)器,可以在大多數(shù)計(jì)算機(jī)操作系統(tǒng)中運(yùn)行,由于其多平臺(tái)和安全性被廣泛使用,是最流行的Web服務(wù)器端軟件之一。它快速、可靠并且可通過(guò)簡(jiǎn)單的API擴(kuò)展,將Perl/Python等解釋器編譯到服務(wù)器中
[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 --最新版本號(hào)
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
創(chuàng)建目錄
[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
關(guān)閉防火墻
[root@rhel-70171 SPN_all]#systemctl status firewalld --查看防火墻狀態(tài)
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? --關(guān)閉防火墻
[root@rhel-70171 SPN_all]#systemctl status firewalld --查看防火墻狀態(tài)
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:關(guān)閉防火墻為可選操作,也可以添加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???不 必先詢問(wèn)用戶,unzip執(zhí) 行后覆蓋原有文件。
-q???執(zhí) 行時(shí)不顯示任何信息。
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 --不帶參數(shù)直接解壓,解壓過(guò)程會(huì)顯示解壓的文件
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時(shí)攔截器內(nèi)error是報(bào)錯(cuò)的堆棧對(duì)象而不是含有data的error對(duì)象
? ? ? ? ? ? ? ? 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時(shí)攔截器內(nèi)error是報(bào)錯(cuò)的堆棧對(duì)象而不是含有data的error對(duì)象
? ? ? ? ? ? ? ? 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
<Directory "/opt/SPN_all/WEB/">
? ? Options Indexes MultiViews FollowSymLinks
? ? AllowOverride All
? ? Order allow,deny
? ? Allow from all
? ? Require all granted
</Directory>
<VirtualHost *:80>
? ? ServerAdmin webmaster@dummy-host.example.com
DocumentRoot/opt/SPN_all/WEB --修改根目錄
ServerName10.240.70.171:80 --修改serverName
? ? ErrorLog logs/spn-all-error_log
? ? CustomLog logs/spn-all-access_log common
</VirtualHost>
httpd.conf 修改
參考文檔:
https://blog.csdn.net/u010433704/article/details/51296326
http://www.itdecent.cn/p/687b915766b6
/etc/httpd/conf/httpd.conf --把80端口監(jiān)聽(tīng)注釋
DocumentRoot --在conf中注釋定義web目錄
在conf中注釋了 servername
定義了Apache的根節(jié)點(diǎn)
ServerRoot "/etc/httpd"
定義了Apache的errorlog目錄loglevel
ErrorLog "logs/error_log"
[root@rhel-70171 logs]# pwd
/etc/httpd/logs
LogLevel warn
定義了ServerRoot用于指定守護(hù)進(jìn)程httpd的運(yùn)行目錄
ServerRoot "/etc/httpd"
問(wèn)題:
1.DocumentRoot注釋了為啥下面的directory為啥不注釋;
2.什么要在這里吧servername和VirtualHost在這里注釋掉,在conf中其實(shí)也可以實(shí)現(xiàn)配置多個(gè)端口
3.在這里定義后端ODL的路徑
數(shù)據(jù)庫(kù)配置
/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的相關(guān)log
[root@rhel-70171 logs]# pwd
/etc/httpd/logs
殺進(jìn)程
[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 --執(zhí)行殺進(jìn)程腳本
清除數(shù)據(jù)庫(kù)緩存
[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介紹