導航:首頁 > 配伺服器 > 兩台伺服器如何能自動切換

兩台伺服器如何能自動切換

發布時間:2023-04-14 22:57:17

㈠ 兩台nfs伺服器怎麼搭建主備自動切換

方法如下:
1、首先建立 auto.master 文件,沒有的話就新建,如果存在的話修改下就行

我的原來就有,於是我就在此基礎上修改的

########################

[root@localhost ~]# vi /etc/auto.master

#
# $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
/misc /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
# "nosuid" and "nodev" options unless the "suid" and "dev"
# options are explicitly given.
#
/net -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
#+auto.master

/var/Net/Files /etc/auto.nfs

################

我把配置文件中紅色的部分注釋掉了,因為存在的話 查看日誌文件的話會有錯誤提示

tail -f /var/log/messages

Dec 2 08:52:21 localhost automount[6475]: lookup_read_master: lookup(nisplus): couldn't locate nis+ table auto.master

2、然後建立目錄

mkdir /var/Net/Files

注意,要保證 Files 目錄是空的

3、建立 auto.nfs 配置文件

[root@localhost ~]# vi /etc/auto.nfs

temp -rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/temp
UPGRADE_FILE -rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/UPGRADE_FILE
UPGRADE_DOC -rw,bg,soft,rsize=32768,wsize=32768 10.2.2.136:/var/Net/Files/UPGRADE_DOC

4、136是伺服器,137是客戶端,紅色部分需要和伺服器中的exports配置文件相對應

[root@localhost rsync]# cat /etc/exports
/var/Net/Files/temp
/ 10.2.2.137(rw,no_root_squash)
/var/Net/Files/UPGRADE_DOC
/ 10.2.2.137(rw,no_root_squash)
/var/Net/Files/UPGRADE_FILE
/ 10.2.2.137(rw,no_root_squash)

伺服器要開啟 portmap 和 nfs 服務

[root@localhost rsync]# /etc/init.d/portmap restart

[root@localhost rsync]# /etc/init.d/nfs restart

5、客戶端啟動 autofs 服務

[root@localhost Files]# /etc/init.d/autofs restart

查看日誌,保證沒有錯誤

tail -f /var/log/messages

查看服務端是否開啟/提供服務

[root@localhost Files]# showmount -e 10.2.2.136(服務端)
Export list for 10.2.2.136:
/var/Net/111 10.2.2.137
/var/Net/Files/temp 10.2.2.137
/var/Net/Files/UPGRADE_DOC 10.2.2.137
/var/Net/Files/UPGRADE_FILE 10.2.2.137

6、測試的方法就是

cd /var/Net/Files目錄中看不見任何內容,

然後

cd UPGRADE_FILE

cd UPGRADE_DOC

cd temp

能進去,能使用 ,差不多就這樣

閱讀全文

與兩台伺服器如何能自動切換相關的資料

熱點內容
陰陽師如何查看哪個伺服器有ID 瀏覽:305
公務員照片壓縮 瀏覽:447
編譯的時候怎麼找未定義的函數 瀏覽:341
有什麼我的世界伺服器 瀏覽:295
伺服器亮綠燈是什麼意思 瀏覽:626
python畫的圖如何保存高清版 瀏覽:488
10的搭接還用加密嗎 瀏覽:361
bytedance這個文件夾是什麼意思呢 瀏覽:585
演算法站的客體 瀏覽:73
src文件夾c語言怎麼運行 瀏覽:19
怎麼把已安裝的app放到桌面 瀏覽:942
如何查看蘋果手機app是否取消訂閱 瀏覽:769
u盤加密之後手機可以打開嗎 瀏覽:42
單片機串口發射怎麼回事 瀏覽:476
程序員假裝自己很忙 瀏覽:800
程序員能力關鍵詞 瀏覽:617
plc編程高級視頻教程 瀏覽:614
java遞歸求n 瀏覽:88
python絕對路徑導入 瀏覽:131
nex5g加密 瀏覽:979