安裝教程 記錄高可用環境搭建

2021-10-09 18:39:07 字數 2911 閱讀 4695

目錄

nginx解除安裝、安裝、驗證

keepalived解除安裝、安裝、驗證

記錄keepalived錯誤

記錄乙個小tip:putty 如何登入另一台linux伺服器

ssh -l login_name hostname

解除安裝nginx比較簡單,由於我本身沒有使用yum安裝,所以需要手動解除安裝

首先全域性查詢ngnix的相關檔案

find / -name nginx*
刪除查詢出來的所有nginx相關檔案,rm -rf

然後開始安裝nginx

putty登陸伺服器進入安裝目錄cd /usr/local

tar -zxvf nginx-1.19.1.tar.gz

# 新建nginx目錄

mkdir mginx

cd nginx-1.19.1

./configure --prefix=/usr/local/nginx

make & make install

啟動nginx

cd usr/local/nginx/sbin

./nginx

驗證啟動成功

可以輸入ps -ef | grep nignx檢視nginx的啟動狀態,出現master就表示啟動成功

或者直接在瀏覽器輸入ip可以看到結果『welcome to nginx』的頁面

停掉nginx的話只要,kill掉主機的nginx,kill -9 pid(pid就是上面ps -ef | grep nignx查到的第二列的序列號)

解除安裝keepalived

進入keepalived的安裝目錄,我的在/usr/local/keepalived

cd /usr/local/keepalived

make uninstall

依次刪除配置keep alive的時候cp的檔案

rm /etc/keepalived/keepalived/conf

rm /etc/sysconfig/keepalived

rm /usr/local/sbin/keepalived

rm /etc/init.d/keepalived

開始安裝

tar -zxvf keepalived-2.0.20.tar.gz

# 新建keepalived目錄

mkdir keepalived

cd keepalived-2.0.20

./configure --prefix=/usr/local/keepalived

# 在安裝之前配置一下openssl的so動態庫,以免安裝會失敗

export library_path=/usr/local/lib64

make & make install

配置keepalived

mkdir /etc/keepalived

cp /usr/local/keepalived/ect/keepalived/keepalived.conf /etc/keepalived/keepalived/conf

cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/keepalived

cp /usr/local/keepalived/sbin/keepalived /usr/local/sbin/keepalived

cp /usr/local/keepalived-2.0.20/keepalived/ect/init.d/keepalived /etc/init.d/keepalived

# 設定開機自啟動

chkconfig -add keepalived

chkconfig keepalived on

#檢視是否已經加入了開機自啟動的序列   

chkconfig -list

#啟動服務   

service keepalived start

#檢視啟動狀態   

systemctl status keepalived

裝keepalived是為了高可用,但是現在沒有在同一網段的伺服器,所以先放下虛擬ip的設定等等

安裝 keepalived 後,啟動時發現報錯,使用命令systemctl status keepalived檢視狀態,有這樣一行:

pid file keepalived.pid not readable (yet?) after start:no such file or directory
開啟/usr/lib/systemd/system目錄下的keepalived.service,看到

pidfile=/run/keepalived.pid
nightwish5

最初我stop keepalived的服務,然後tcpdump -i ens33 vrrp -n ,奇怪的是竟然還有vrrp的包在跑 ps -ef | grep keepalive ,發現還有程序。我用pkill -9 keepalived。然後重啟keepalived就正常了。 keepalived正常執行的話,檔案/var/run/keepalived.pid是自動生成的。

果斷輸入pkill -9 keepalived

然後service keepalived restart

終於終於,喜大普奔,感謝nightwish5!!!

SpringCloud高可用環境搭建

eureka server 高可用環境需要部署兩個eureka server,它們互相向對方註冊。如果在本機啟動兩個eureka需要 注意兩個eureka server的埠要設定不一樣,這裡我們部署乙個eureka server工程,將埠可配置,製作兩個 eureka server啟動指令碼,啟動不...

milvus高可用搭建

基於keepalived部署milvus高可用問題 雙寫冷備 兩個寫節點不能同時啟動,否則會導致資料重複,通過增加與閘道器的連通性來解決可能同時啟動的問題,但不能完全保證沒有特殊情況的存在。另外宕機時可能會導致資料丟失。一寫一讀 可以同時啟動,但是寫節點宕機時,資料不能寫入。基於minio的共享儲存...

mysql keepalived搭建高可用環境

假設已經搭建好了mysql並且存在正常狀態的主主複製 1 安裝keepalived並且根據業務的vip及主機網絡卡,ip配置好 etc keepalived keepalived.conf,具體操作已在 框中實現 1 安裝環境 謹慎,建議先編譯,能通過就不要進行第一步了 yum y install ...