Debian 10 Buster
Sponsored Link

NIS : NISスレーブの設定2019/07/29

 
NIS スレーブサーバーを構築し、NIS マスターサーバーダウン時も NIS クライアントに対してサービスを継続できるようにします。
+----------------------+          |          +----------------------+
| [    NIS Server    ] |10.0.0.30 | 10.0.0.31| [    NIS Client    ] |
|     dlp.srv.world    +----------+----------+     www.srv.world    |
|                      |          |          |                      |
+----------------------+          |          +----------------------+
+----------------------+          |
| [     NIS Slave    ] |10.0.0.51 |
|   node01.srv.world   +----------+
|                      |
+----------------------+

[1]
[2] NIS スレーブとするホストの設定です。
root@node01:~#
vi /etc/default/nis
# 6行目:変更(NISスレーブとする)

NISSERVER=
slave
root@node01:~#
vi /etc/ypserv.securenets
# This line gives access to everybody. PLEASE ADJUST!
# コメントにする

#
0.0.0.0 0.0.0.0
# 最終行:アクセス許可する範囲追記

255.255.255.0   10.0.0.0

root@node01:~#
vi /etc/hosts
127.0.0.1       localhost
# NISデータベース登録用に自身のIPを登録

10.0.0.51       node01.srv.world        node01

root@node01:~#
systemctl restart nis

# マスターサーバーのデータベース同期

root@node01:~#
/usr/lib/yp/ypinit -s dlp.srv.world

We will need a few minutes to copy the data from dlp.srv.world.
Transferring group.bygid...
Trying ypxfrd ... success
.....
.....
At this point, make sure that /etc/passwd and /etc/group have
been edited so that when the NIS is activated, the data bases you
have just created will be used, instead of the /etc ASCII files.
[3]
NIS マスターサーバーも NIS クライアントである必要があります。 こちらを参考に NIS マスターサーバーを NISクライアントとして設定しておきます。
[4] NIS マスターサーバーで、新たに構築した NISスレーブサーバー用の設定をします。
root@dlp:~#
vi /var/yp/Makefile
# 23行目:変更

NOPUSH=
false
# NISデータベース更新

root@dlp:~#
/usr/lib/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers.  dlp.srv.world is in the list of NIS server hosts.  Please continue to add
the names for the other hosts, one per line.  When you are done with the
list, type a <control D>.
        next host to add:  dlp.srv.world
        next host to add:  node01.srv.world   # NISスレーブを指定
        next host to add:                     # Ctrl + D キー
The current list of NIS servers looks like this:

dlp.srv.world
node01.srv.world

Is this correct?  [y/n: y] y

.....
.....
dlp.srv.world has been set up as a NIS master server.

Now you can run ypinit -s dlp.srv.world on all slave server.
[5] NIS クライアントがスレーブサーバーも参照できるよう設定します。 以上により、マスターサーバーダウン時も、参照先がスレーブサーバーに自動で切り替わり、NIS サービスは継続されるようになります。
root@www:~#
vi /etc/yp.conf
# 最終行にスレーブサーバーを追記

domain srv.world server dlp.srv.world
domain srv.world server node01.srv.world
root@www:~#
systemctl restart nis
関連コンテンツ