部署架構(gòu)圖
[圖片上傳失敗...(image-d80a8c-1640071734791)]
基礎(chǔ)組件說明:
salt,rabbitmq,redis,mysql,nginx,python3,兩臺linux的部署基礎(chǔ)組件:
1.nginx:
部署地址:服務(wù)器A 服務(wù)器B
2.mysql
部署地址:任意一臺或者外部集群 1.11 上面有mysql
3.redis
部署地址:任意一臺或者外部集群
4.rabbitmq
部署地址:任意一臺或外部機器
5.python3
部署地址:服務(wù)器A 服務(wù)器B
| |
| | [圖片上傳失敗...(image-63350-1640071734784)]
|
代碼部署說明:
1.Devops 災(zāi)備web系統(tǒng)
部署地址:服務(wù)器A 服務(wù)器B
2.saltSatck 執(zhí)行調(diào)用接口分發(fā)系統(tǒng)
部署地址: 服務(wù)器A 服務(wù)器B
3.SaltWorker 結(jié)果分析系統(tǒng) 部署地址:(只啟動一個)
服務(wù)器A 服務(wù)器B
4.sworker 任務(wù)執(zhí)行work 部署地址:
服務(wù)器A
| |
| | [圖片上傳失敗...(image-313f08-1640071734782)]
|
基礎(chǔ)組件部署安裝步驟:
(一) 安裝python3
Yum –y install wget*
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
mv Python-3.6.3.tgz /usr/local/src/
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
cd /usr/local/src/
tar -zxvf Python-3.6.1.tgz
cd Python-3.6.1
./configure --prefix=/usr/local/python3.6.3
出現(xiàn)以下標(biāo)志信息:
[圖片上傳失敗...(image-75911b-1640071734791)]
make && make install 出現(xiàn)以下標(biāo)示:
[圖片上傳失敗...(image-3c73c7-1640071734791)]
cp -r /usr/local/python3.6/ /usr/bin/
mv /usr/bin/python /usr/bin/pythonbak
ln -s /usr/local/python3.6.3/bin/python3.6 /usr/bin/python3
加入環(huán)境變量:
臨時:export PATH=/usr/local/python3.6.1/bin:$PATH
永久性的:vi /etc/profile 在最后加入: export PATH=/usr/local/python3.6/bin:$PATH保存后:source /etc/profile
Env 查看相關(guān)的環(huán)境變量信息
vi /usr/bin/yum
修改第一行為:#!/usr/bin/python2.7
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6
python3 setup.py build
python3 setup.py install
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
ln -s /usr/local/python3.6.3/bin/pip /usr/bin/pip
pip install --upgrade pip
報錯:
1.編碼問題:
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN.UTF-8
之后就解決了 裝好后,unset export LANG下..
[圖片上傳失敗...(image-b1bcd1-1640071734791)]
(二)Nginx中間件安裝:
安裝包:https://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.6.2.tar.gz
yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-pcre=/usr/local/src/pcre-8.35
make
make install
/usr/local/webserver/nginx/sbin/nginx –v 查看版本信息
啟動 /usr/local/webserver/nginx/sbin/nginx -c /usr/local/webserver/nginx/conf/nginx.conf
啟動nginx /usr/local/webserver/nginx/sbin/nginx
關(guān)閉 nginx /usr/local/webserver/nginx/sbin/nginx -s stop
重啟nginx /usr/local/webserver/nginx/sbin/nginx –s reload
關(guān)閉 nginx /usr/local/webserver/nginx/sbin/nginx –s stop
安裝源庫
chmod +x nginx-release-centos-7-0.el7.ngx.noarch.rpm
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
yum -y install nginx
訪問相關(guān)的網(wǎng)址 192.168.10.11:80
(二)mysql數(shù)據(jù)庫安裝 10.11直接yum安裝了
rpm -qa |grep mysql
rpm -e –nodeps mysql-community-release-el6-5.noarch
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql-community-server
systemctl status mysqld
systemctl start mysqld
systemctl enable mysqld
mysqld –initalize 進行密碼得重置
grep 'temporary password' /var/log/mysqld.log 可以看到臨時得密碼信息等 V4Q#aYK!0MQz
然后進行登錄 mysql –uroot –p
輸入密碼:
更改密碼:ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
set global validate_password_policy=0;
set global validate_password_length=1;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root'; 將密碼修改為root
grant all privileges on . to 'root'@'%' identified by 'root' with grant option;
systemctl restart mysqld 重啟相關(guān)得mysql服務(wù)
(三)redis安裝
wget http://download.redis.io/releases/redis-3.0.0.tar.gz
tar zxvf redis-3.0.0.tar.gz
cd redis-3.0.0
make
make test
mkdir -p /etc/redis
cp redis.conf /etc/redis/6379.conf
將啟動文件拷貝到init.d中匀泊, Cp utils/redis_init_script /etc/init.d/redisd
修改啟動腳本參數(shù) , vi /etc/init.d/redisd
添加已下代碼
chkconfig: 2345 10 90
description: Start and Stop redisd
修改
EXEC= /root/redis-3.0.0/src/redis-server
CLIEXEC= /root/redis-3.0.0/src/redis-cli
PIDFILE=/etc/redis/redis_${REDISPORT}.pid
啟動方式
service redisd start 開啟來redis-server
/root/redis-3.0.0/src/redis-server /etc/redis/redis.conf 開啟
whereis redis 找到redis得具體路徑信息
開啟redis-cli
/root/redis-3.0.0/src/redis-cli
redis-cli -p 6379 -a redis 使用密碼登錄
redis-cli -h 127.0.0.1 -p 6379 -a "redis" 遠(yuǎn)程登錄
修改密碼
1-需要重啟服務(wù),找到redis.conf 修改requirepass這個配置文件,取消注釋后面設(shè)置成需要得密碼
2-連接redis后,config set requirepass redis ,則密碼就設(shè)置成立redis, config get requirepass 可以看到密碼例诀,需要輸入 auth redis 然后輸入ping,顯示PONG就可以了
(四) rabbitmq安裝
RabbitMQ是實現(xiàn)了高級消息隊列協(xié)議(AMQP)
RabbitMQ之前, 需要先安裝Erlang 裁着,rabbitmq需要socat依賴,
yum install xmlto gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel unixODBC-devel wxBase wxGTK wxGTK-gl perl –y
下載erlang
安裝Erlang依賴yum -y install gcc glibc-devel make ncurses-devel openssl-devel xmlto
rpm -ivh erlang-23.2.7-1.el7.x86_64.rpm
測試是否正常
輸入命令:erl 看到相關(guān)得命令則說明正常
Erlang/OTP 23 [erts-11.1.8] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Eshell V11.1.8 (abort with ^G)
1>
輸入halt(). 則退出命令行就可以了
安裝rabbitMQ
yum install -y socat
rpm -ivh rabbitmq-server-3.9.3-1.el8.noarch.rpm
rabbitmq-server start ----------------------(前臺啟動繁涂,ctrl+c進程就掛了)
rabbitmq-server -detached ----------------------(后臺啟動)
ps -ef | grep rabbitmq ----------------------(查看rabbitmq進程)
rabbitmqctl stop 關(guān)閉rabbitmq進程
啟動web管理界面(沒有啟動瀏覽器是訪問不了的 rabbitmq-plugins enable rabbitmq_management
關(guān)閉管控臺: rabbitmq-plugins disable rabbitmq_management
systemctl stop firewalld 關(guān)閉防火墻
systemctl disable firewalld
開啟web管理插件
rabbitmq-plugins enable rabbitmq_management
啟動服務(wù)
systemctl start rabbitmq-server.service
添加rabbitMQ用戶跟權(quán)限
./rabbitmqctl add_user admin guest -----------------------(添加用戶,用戶名admin二驰,密碼admin)
./rabbitmqctl set_permissions -p / admin "." "," ".*" -----------------------(給admin用戶設(shè)置訪問權(quán)限)
./rabbitmqctl set_user_tags admin administrator -----------------------(給admin設(shè)置為管理員)
rabbitmqctl delete_user guest
啟動:systemctl start rabbitmq-server.service
啟動控制臺:rabbitmq-plugins enable rabbitmq_management
WEB訪問:http://192.168.1.11:15672/ 賬號:admin 密碼:guest