1、在 Rancher 的卷中,添加:/webtv:/data。如图1
2、查看容器的日志,报错:LOG_NAME: unbound variable。如图2
2020/8/3 下午4:40:16/config/init/cronlog.sh: line 5: LOG_NAME: unbound variable 2020/8/3 下午4:40:19sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 2020/8/3 下午4:40:19bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8) 2020/8/3 下午4:40:19/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
3、进入容器,查看 /data 下的目录列表,不符合预期。未挂载成功。如图3
[root@955ea658d009 data]# ls -l total 24 drwxr-xr-x 2 root root 4096 Apr 29 15:27 cmclogs drwx--x--x 2 root root 4096 Jun 28 11:31 conf drwxr-xr-x 2 root root 4096 Apr 21 16:13 log-static drwx--x--x 2 root root 4096 Jun 28 11:31 logs drwx--x--x 2 root root 4096 Jun 28 11:31 run drwxr-xr-x 6 root root 4096 Jun 28 12:42 wangjie
4、在 Rancher 的调度中,添加调度规则。如图4
5、再次升级后,进入容器,查看 /data 下的目录列表,符合预期。NAS 存储挂载成功。如图5
[root@08dfcc44c6e2 /]# cd /data/ [root@08dfcc44c6e2 data]# ls -l total 3485844 drwxr-xr-x 2 root root 6 Sep 6 2019 96 drwxr-xr-x 3 4294967294 4294967294 24 Apr 10 2019 BSAudit drwxr-xr-x 3 root root 26 Jul 9 2019 ForPublic drwxr-xr-x 4 root root 30 Dec 26 2018 SRS -rw-r--r-- 1 root root 14107659 May 14 10:08 catalina.out.2020-05-14.log drwxrwxrwx 3 nginx nginx 93 Jun 15 13:50 cmclogs drwx--x--x 2 root root 6 Jun 28 11:30 conf drwxr-xr-x 3 root root 20 Apr 10 2019 console drwxrwxrwx 12 root root 139 Apr 10 2019 content drwxr-xr-x 4 root root 47 Aug 13 2019 editor drwxr-xr-x 3 root root 123 May 13 2019 elastic drwxrwxrwx 3 root root 26 Feb 28 15:53 esdata drwxrwxrwx 3 root root 26 Feb 28 16:02 esdatadev drwxrwxrwx 3 root root 26 Jul 22 16:02 esdatadev2 drwxr-xr-x 2 root root 19 Jul 8 2019 ffmpeg -rw------- 1 root root 3167531079 May 7 2019 gc.hprof -rw-r--r-- 1 root root 387737048 May 7 2019 gc.tar.gz -rw-r--r-- 1 root root 664 Apr 10 2019 header.txt -rw-r--r-- 1 root root 1195 Jun 19 2019 hua-qiyun-6803fac4-b7c0-4fea-a44b-332e171e95d5-v5.json drwxr-xr-x 2 root root 4096 Aug 3 00:00 log-cms drwxr-xr-x 2 nginx nginx 4096 Aug 3 14:23 log-static drwx--x--x 6 root root 16384 Aug 3 16:57 logs drwxrwxrwx 2 root root 6 Jun 8 13:34 media drwxr-xr-x 4 root root 48 Jul 29 2019 models drwxrwxrwx 3 root root 17 Dec 11 2018 ms3 drwxr-xr-x 47 systemd-bus-proxy input 4096 Mar 25 23:40 mysql drwxrwxrwx 4 root root 35 Dec 11 2018 nas-tmp -rw-r--r-- 1 root root 40956 Oct 29 2019 output.mp3 drwxr-xr-x 6 root root 67 Mar 6 10:50 pgc drwxr-xr-x 3 root root 25 Dec 13 2019 pic -rw-r--r-- 1 root root 9 Apr 10 2019 requestBodyParams.txt -rw-r--r-- 1 root root 573 Apr 10 2019 requestRowBody.txt drwx--x--x 2 root root 6 Jun 28 11:30 run drwxr-xr-x 8 root root 4096 Mar 16 16:42 shift drwxr-xr-x 14 root root 4096 Mar 17 04:00 shiftdev drwxr-xr-x 8 root root 106 May 15 21:09 site -rw-r--r-- 1 root root 3178 Jun 14 2019 spiderLogo.png drwxrwxrwx 6 systemd-bus-proxy input 155 Jun 19 15:34 sqldev drwxrwxrwx 4 root root 41 Jun 8 13:37 trans drwxr-xr-x 8 nginx nginx 4096 Jun 28 13:28 version_sql drwxr-xr-x 3 root root 25 Dec 13 2019 video drwxr-xr-x 2 root root 6 Nov 27 2019 vidoe drwxrwxrwx 36 root root 4096 Jul 31 11:33 wangjie drwxrwxrwx 18 root root 4096 Jul 31 18:32 wangjiebase drwxrwxrwx 17 root root 4096 Jul 3 17:14 wangjiedev drwxrwxr-x 10 root root 102 Apr 11 2019 wangjieweb drwxrwxrwx 4 root root 33 Mar 29 2019 wangjiewjweb drwxr-xr-x 3 root root 20 May 20 2019 webtv drwxr-xr-x 3 root root 20 Jan 31 2019 wjdev drwxr-xr-x 4 root root 34 Mar 18 2019 wpdt drwxrwxrwx 6 root root 54 Apr 9 2019 xContent drwxrwxrwx 5 root root 58 Jul 3 16:49 xcontent drwxrwxrwx 3 root root 17 Apr 10 2019 xtrimmer drwxrwxrwx 7 root root 140 Jul 21 15:19 zqtest
6、分析添加调度规则前后的区别。添加前,其主机为:lb。添加后,其主机为:wjdev02。如图6、图7
7、分别查看主机:lb、wjdev02 的存储,lb 上不存在 /webtv,wjdev02 上存在 /webtv。如图8、图9
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/251065.html