日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ipv6禁用导致rpcbind服务启动失败实例

發布時間:2024/1/18 编程问答 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ipv6禁用导致rpcbind服务启动失败实例 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ipv6禁用導致rpcbind服務啟動失敗實例

昨天在做服務器磁盤分區擴容的時候出現過一個服務啟動的問題,在此記錄。
情景再現:前天晚上申請做磁盤擴容,得到批準后,昨天早上5點開始做停機調整維護,歷經2個多小時的折騰,擴充完畢,有關這部分內容請參考上篇博文 (?https://blog.51cto.com/hld1992/2054837) 而后重啟機器,檢查服務,nginx,php-fpm,redis,svn,nfs(?)都啟動正常。然后,去另一臺機器上掛載nfs,問題出現了,nfs無響應。回來檢查nfs服務:

好嘛,rpcbind服務沒有啟動,趕緊啟動服務。

[root@BZ ~]# systemctl start rpcbind A dependency job for rpcbind.service failed. See 'journalctl -xe' for details.

報錯了,根據提示使用journalctl -xe看一下日志:

[root@BZ ~]# journalctl -xe -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit session-3.scope has begun starting up. Dec 26 21:34:26 BZ chronyd[490]: System clock wrong by -1.090838 seconds, adjustment started Dec 26 21:35:31 BZ chronyd[490]: Selected source 61.216.153.107 Dec 26 21:35:31 BZ chronyd[490]: System clock wrong by 0.646329 seconds, adjustment started Dec 26 21:36:24 BZ polkitd[484]: Registered Authentication Agent for unix-process:2701:32282 (system bus name :1.29 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) Dec 26 21:36:24 BZ systemd[1]: rpcbind.socket failed to listen on sockets: Address family not supported by protocol #報錯顯示ip地址協議不支持 Dec 26 21:36:24 BZ systemd[1]: Failed to listen on RPCbind Server Activation Socket. #端口監聽失敗 -- Subject: Unit rpcbind.socket has failed -- Defined-By: systemd -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel -- -- Unit rpcbind.socket has failed. -- -- The result is failed. Dec 26 21:36:24 BZ systemd[1]: Dependency failed for RPC bind service.

于是趕緊谷歌了下,發現是由于ipv6被禁用導致的。查看下/etc/sysctl.conf

[root@BZ ~]# less /etc/sysctl.conf | grep 'net.ipv6' net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1

果然ipv6被禁用了。由于當時情況緊急,我采取了一個比較不好的方法,把ipv6啟用了(后面還有其他方法介紹)。

[root@BZ ~]# sed -i 's@net.ipv6.conf.all.disable_ipv6 = 1@net.ipv6.conf.all.disable_ipv6 = 0@g' /etc/sysctl.conf [root@BZ ~]# sysctl -p ... net.ipv6.conf.all.disable_ipv6 = 0

再次啟動rpcbind

[root@BZ ~]# systemctl start rpcbind [root@BZ ~]# systemctl status rpcbind ● rpcbind.service - RPC bind serviceLoaded: loaded (/usr/lib/systemd/system/rpcbind.service; indirect; vendor preset: enabled) Active: active (running) since Tue 2017-12-26 21:48:22 EST; 7s ago Process: 2734 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS) Main PID: 2735 (rpcbind) CGroup: /system.slice/rpcbind.service └─2735 /sbin/rpcbind -w Dec 26 21:48:22 BZ systemd[1]: Starting RPC bind service... Dec 26 21:48:22 BZ systemd[1]: Started RPC bind service.

啟動成功。再啟動nfs

[root@BZ ~]# systemctl start nfs [root@BZ ~]# systemctl status nfs ● nfs-server.service - NFS server and servicesLoaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled; vendor preset: disabled) Active: active (exited) since Tue 2017-12-26 21:50:05 EST; 996ms ago Process: 2761 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS) Process: 2756 ExecStartPre=/bin/sh -c /bin/kill -HUP `cat /run/gssproxy.pid` (code=exited, status=0/SUCCESS) Process: 2755 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS) Main PID: 2761 (code=exited, status=0/SUCCESS) CGroup: /system.slice/nfs-server.service Dec 26 21:50:05 BZ systemd[1]: Starting NFS server and services... Dec 26 21:50:05 BZ systemd[1]: Started NFS server and services.

再次去客戶端掛載nfs就可以成功了。

========================================================================
剛才說了,啟動ipv6當然不是一個好的方法,下面來繼續說明下。
從前面的報錯日志中我們可以看到,rpcbind.service依賴rpcbind.socket

-- Unit rpcbind.socket has failed.

既然rpcbind.socket啟動失敗,那應該在它的配置文件中會有關于ipv6的配置,我來找一下:

[root@BZ ~]# find /etc/ -name '*rpcbind.socket*'/etc/systemd/system/sockets.target.wants/rpcbind.socket

進去看下:

[Unit] Description=RPCbind Server Activation Socket [Socket] ListenStream=/var/run/rpcbind.sock ListenStream=[::]:111 #果然監聽了ipv6地址,將這一行注釋即可 ListenStream=0.0.0.0:111 BindIPv6Only=ipv6-only [Install] WantedBy=sockets.target

將關于ipv6的相關配置注釋后,重啟rpcbind.socket

[root@BZ ~]# systemctl restart rpcbind.socket Warning: rpcbind.socket changed on disk. Run 'systemctl daemon-reload' to reload units.

systemd發現配置文件有改動,需要重載一下。

[root@BZ ~]# systemctl daemon-reload

再次重啟

[root@BZ ~]# systemctl restart rpcbind.socket [root@BZ ~]# systemctl status rpcbind.socket ● rpcbind.socket - RPCbind Server Activation SocketLoaded: loaded (/usr/lib/systemd/system/rpcbind.socket; enabled; vendor preset: enabled)Active: active (running) since Tue 2017-12-26 22:01:45 EST; 9s ago Listen: /var/run/rpcbind.sock (Stream) 0.0.0.0:111 (Stream) #只監聽了ipv4的111端口

后記

在谷歌的過程中,發現還有一種方法來解決這個問題。具體就是使用dracut -v -f 命令重建下initramfs,然后重啟機器即可。
還有一個問題就是rpcbind設置開機自啟動失敗

[root@BZ ~]# systemctl enable rpcbind.service [root@BZ ~]# systemctl is-enabled rpcbind.service indirect

不知道是什么原因,希望有大神可以幫我解答啊,萬分感謝,我現在是把它放到了/etc/rc.d/rc.local里面了。

轉載于:https://www.cnblogs.com/gaoyuechen/p/10538525.html

總結

以上是生活随笔為你收集整理的ipv6禁用导致rpcbind服务启动失败实例的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。