• 高可用双机GPFS集群的的自动化部署脚本


    1.环境说明:

    系统主机名IP地址内存添加共享磁盘大小
    Centos7.9gpfs1192.168.10.1012G20G
    Centos7.9gpfs2192.168.10.1022G20G

    2.配置共享硬盘:

    • 前提:两台虚拟机没有拍摄快照

    • 在mds001主机中:

      • 添加五块5G的硬盘

        SCSI > 创建新虚拟磁盘 > 指定磁盘容量 ,立即分配所有磁盘空间,将虚拟磁盘存储为单个文件

      • 修改磁盘属性:

    • 在mds002主机中:

      • 添加5块5G的硬盘

        SCSI > 使用已有的虚拟磁盘 > 指定磁盘容量 ,立即分配所有磁盘空间,将虚拟磁盘存储为单个文件 > 选择mds001主机新添加的磁盘文件

      • 修改磁盘属性:

    • 在mds001和mds002的虚拟机目录下,找个后缀名为vmx的文件,在文件末尾添加一下内容:

      1. scsi1.sharedBus = "virtual"
      2. disk.locking = "false"
      3. diskLib.dataCacheMaxSize = "0"
      4. diskLib.dataCacheMaxReadAheadSize = "0"
      5. diskLib.dataCacheMinReadAheadSize = "0"
      6. diskLib.dataCachePageSize = "4096"
      7. diskLib.maxUnsyncedWrites = "0"
      8. disk.EnableUUID = "TRUE"

    3.完整的脚本:

    1. #! /bin/bash
    2. # 高可用双机GPFS集群的的自动化部署脚本,(部署条件:配置了共享磁盘,网卡已经配置了IP地址,上传gpfs软件包到某个目录下,确保自己内核是3.10.0-1160.el7.x86_64版本)
    3. # 作者:屈**
    4. # 时间:2023922
    5. # 版本:1.0.0
    6. host_address=(192.168.10.101 192.168.10.102)
    7. host_hostname=(node1 node2)
    8. host_passwd=110119
    9. # NSD磁盘的名称
    10. nsd_name=(NSD_1 NSD_2)
    11. # 输出nsd名字列表以逗号隔开
    12. hostname_douhao=`printf "%s," "${my_array[@]}" | sed 's/,$//'`
    13. # 输出nsd名字列表以分号隔开
    14. hostname_fenhao=`printf "%s," "${my_array[@]}" | sed 's/,$//'`
    15. # NSD磁盘的设备磁盘名在/dev下,可通过lsblk命令查看
    16. nsd_device=(sdb sdc)
    17. # 集群的名字和文件系统的名字
    18. gpfs_cluster_name=gpfs
    19. file_system_name=gpfs1
    20. # 安装expect命令
    21. expect -v &> /dev/null
    22. if [ `echo $?` -ne 0 ];then
    23. echo "没有expect,安装expect命令"
    24. yum install -y expect
    25. fi
    26. # 配置免密登录
    27. echo "########################## 本地开始配置ssh ##########################"
    28. if [ `test -a ~/.ssh/id_rsa.pub;echo $?` == 0 ];then
    29. echo "ssh公钥已创建"
    30. else
    31. echo "ssh公钥未创建,开始创建"
    32. /usr/bin/expect << eof
    33. # 设置捕获字符串后,期待回复的超时时间
    34. set timeout 10
    35. spawn ssh-keygen -t rsa -b 1024
    36. ## 开始进连续捕获
    37. expect {
    38. "connecting (yes/no)?" { send "yes\n"; exp_continue }
    39. "s password:" { send "${host_passwd}\n"; exp_continue }
    40. ".ssh/id_rsa)" { send "\n"; exp_continue }
    41. "Overwrite (y/n)?" { send "y\n"; exp_continue }
    42. "no passphrase):" { send "\n"; exp_continue }
    43. "passphrase again:" { send "\n"; exp_continue }
    44. }
    45. eof
    46. fi
    47. # 本地的密钥开始加入被控制主机
    48. for ((j=0;j<2;j++));do
    49. echo "########################## ${host_address[j]}正在被添加公钥 ##########################"
    50. /usr/bin/expect << eof
    51. # 设置捕获字符串后,期待回复的超时时间
    52. set timeout 10
    53. spawn ssh-copy-id -i /root/.ssh/id_rsa.pub root@${host_address[j]}
    54. ## 开始进连续捕获
    55. expect {
    56. "connecting (yes/no)?" { send "yes\n"; exp_continue }
    57. "s password:" { send "${host_passwd}\n"; exp_continue }
    58. }
    59. eof
    60. echo "############# ${host_address[j]}配置完毕 #############"
    61. done
    62. # 被控制主机开始创建密钥
    63. for ((j=0;j<2;j++));do
    64. echo "########################## ${host_address[j]}开始创建密钥 ##########################"
    65. if [ `ssh root@${host_address[j]} 'test -a ~/.ssh/id_rsa.pub;echo $?'` == 0 ];then
    66. echo "ssh公钥已创建"
    67. else
    68. echo "ssh公钥未创建,开始创建"
    69. /usr/bin/expect << eof
    70. # 设置捕获字符串后,期待回复的超时时间
    71. set timeout 10
    72. spawn ssh root@${host_address[j]} "ssh-keygen -t rsa -b 1024"
    73. ## 开始进连续捕获
    74. expect {
    75. "connecting (yes/no)?" { send "yes\n"; exp_continue }
    76. "s password:" { send "${host_passwd}\n"; exp_continue }
    77. ".ssh/id_rsa)" { send "\n"; exp_continue }
    78. "Overwrite (y/n)?" { send "y\n"; exp_continue }
    79. "no passphrase):" { send "\n"; exp_continue }
    80. "passphrase again:" { send "\n"; exp_continue }
    81. }
    82. eof
    83. fi
    84. echo "############# ${host_address[j]}配置完毕 #############"
    85. done
    86. # 被控制主机开始分配密钥
    87. for ((j=0;j<2;j++));do
    88. for((k=0;k<2;k++));do
    89. echo "########################## ${host_address[j]}开始分配公钥给${host_address[k]} ##########################"
    90. /usr/bin/expect << eof
    91. # 设置捕获字符串后,期待回复的超时时间
    92. set timeout 10
    93. spawn ssh -t root@${host_address[j]} "ssh root@${host_address[k]}"
    94. spawn ssh -t root@${host_address[j]} "ssh-copy-id -i /root/.ssh/id_rsa.pub root@${host_address[k]}"
    95. ## 开始进连续捕获
    96. expect {
    97. "connecting (yes/no)?" { send "yes\n"; exp_continue }
    98. "s password:" { send "${host_passwd}\n"; exp_continue }
    99. }
    100. eof
    101. echo "############# ${host_address[j]}配置完毕 #############"
    102. done
    103. done
    104. # 修改主机名和配置域名映射
    105. for ((i=0;i<100;i++));do
    106. read -p "修改主机名和配置域名映射?(Y/n): " flag
    107. if [ "${flag}" == "Y" ];then
    108. sleep 3
    109. echo "########################## 开始配置主机名和域名映射 ##########################"
    110. for ((j=0;j<2;j++));do
    111. if [ `ssh root@${host_address[j]} "hostname"` != "${host_hostname[j]}" ];then
    112. ssh root@${host_address[j]} "hostnamectl set-hostname ${host_hostname[j]}"
    113. fi
    114. ssh root@${host_address[j]} "cat << eof > /etc/hosts
    115. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    116. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    117. eof"
    118. for ((k=0;k<2;k++));do
    119. ssh root@${host_address[j]} "echo '${host_address[k]} ${host_hostname[k]}' >> /etc/hosts"
    120. done
    121. done
    122. echo "############# 配置完毕 #############"
    123. break
    124. elif [ "${flag}" == "n" ];then
    125. echo "############# 已跳过步骤-修改主机名和配置域名映射 #############"
    126. break
    127. elif [ ${i} -eq 99 ];then
    128. echo "############# 已退出 #############"
    129. exit
    130. else continue;fi
    131. done
    132. # 测试被控主机ssh连接
    133. for ((j=0;j<2;j++));do
    134. echo "########################## ${host_address[j]}开始测试 ##########################"
    135. for ((k=0;k<2;k++));do
    136. /usr/bin/expect << eof
    137. # 设置捕获字符串后,期待回复的超时时间
    138. set timeout 10
    139. spawn ssh -t root@${host_address[j]} "ssh root@${host_address[k]}"
    140. ## 开始进连续捕获
    141. expect {
    142. "connecting (yes/no)?" { send "yes\n"; exp_continue }
    143. }
    144. eof
    145. if [ `echo $?` != 0 ];then
    146. echo "${host_hostname[j]}主机无法免密登录${host_hostname[k]}"
    147. exit
    148. fi
    149. done
    150. echo "############# ${host_address[j]}测试完毕 #############"
    151. done
    152. # 配置防火墙和selinux
    153. for ((i=0;i<100;i++));do
    154. read -p "配置防火墙和selinux?(Y/n): " flag
    155. if [ "${flag}" == "Y" ];then
    156. sleep 3
    157. for ((j=0;j<2;j++));do
    158. echo "########################## ${host_address[j]}开始配置防火墙和selinux ##########################"
    159. ssh root@${host_address[j]} "systemctl stop firewalld;systemctl disable firewalld"
    160. ssh root@${host_address[j]} "sed -i 's/SELINUX=.*/SELINUX=disabled/' /etc/selinux/config"
    161. echo "############# 配置完毕 #############"
    162. done
    163. break
    164. elif [ "${flag}" == "n" ];then
    165. echo "############# 已跳过步骤-配置防火墙和selinux #############"
    166. break
    167. elif [ ${i} -eq 99 ];then
    168. echo "############# 已退出 #############"
    169. exit
    170. else continue;fi
    171. done
    172. # 配置yum源
    173. for ((i=0;i<100;i++));do
    174. read -p "配置yum源?(Y/n): " flag
    175. if [ "${flag}" == "Y" ];then
    176. sleep 3
    177. echo "########################## 开始配置ssh ##########################"
    178. for ((j=0;j<2;j++));do
    179. echo "########################## 配置${host_address[j]}的本地yum源 ##########################"
    180. ssh root@${host_address[j]} "mkdir /mnt/cdrom &> /dev/null;mount /dev/cdrom /mnt/cdrom"
    181. if [ -z "`ssh root@${host_address[j]} "grep '^\/dev\/cdrom' /etc/fstab"`" ];then
    182. ssh root@${host_address[j]} "cat << eof >> /etc/fstab
    183. /dev/cdrom /mnt/cdrom iso9660 defaults 0 0
    184. eof"
    185. fi
    186. ssh root@${host_address[j]} "cat << eof > /etc/yum.repos.d/centos-local.repo
    187. [centos7.9]
    188. name=centos7.9
    189. baseurl=file:///mnt/cdrom
    190. enabled=1
    191. gpgcheck=0
    192. eof"
    193. echo "############# ${host_address[j]}配置完毕 #############"
    194. echo "########################## 配置${host_address[j]}的扩展源 ##########################"
    195. ssh root@${host_address[j]} "yum install epel-release -y"
    196. echo "############# ${host_address[j]}配置完毕 #############"
    197. echo "########################## 配置${host_address[j]}的阿里yum源 ##########################"
    198. ssh root@${host_address[j]} "yum install -y wget"
    199. if [ `ssh root@${host_address[j]} 'test -a /etc/yum.repos.d/CentOS-Base.repo;echo $?'` == 0 ];then
    200. ssh root@${host_address[j]} "wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo"
    201. fi
    202. ssh root@${host_address[j]} "yum clean all && yum repolist"
    203. echo "############# ${host_address[j]}配置完毕 #############"
    204. if [ `ssh root@${host_address[j]} "echo $?"` != 0 ];then
    205. echo "yum源配置有误,退出执行脚本"
    206. exit
    207. fi
    208. done
    209. break
    210. elif [ "${flag}" == "n" ];then
    211. echo "############# 已跳过步骤-配置yum源 #############"
    212. break
    213. elif [ ${i} -eq 99 ];then
    214. echo "############# 已退出 #############"
    215. exit
    216. else continue;fi
    217. done
    218. # 配置chrony时间服务器
    219. for ((i=0;i<100;i++));do
    220. read -p "配置chrony时间服务器?(Y/n): " flag
    221. if [ "${flag}" == "Y" ];then
    222. sleep 3
    223. echo "########################## 开始配置chrony ##########################"
    224. for ((j=0;j<2;j++));do
    225. if [ `ssh root@${host_address[j]} "systemctl restart chronyd;echo $?"` != 0 ];then
    226. echo "${host_address[j]} 安装chrony"
    227. ssh root@${host_address[j]} "yum install -y chrony && systemctl restart chronyd"
    228. if [ `echo $?` != 0 ];then
    229. echo "安装失败,请排错!"
    230. exit
    231. fi
    232. fi
    233. echo "${host_address[j]}配置chrony"
    234. ssh root@${host_address[j]} "sed -i '/^server/d' /etc/chrony.conf"
    235. if [ ${host_address[j]} == ${host_address[0]} ];then
    236. ssh root@${host_address[j]} "sed -i '2a\server '"${host_address[0]}"' iburst\' /etc/chrony.conf"
    237. ssh root@${host_address[j]} "sed -i 's/#allow 192.168.0.0\/16/allow 192.168.10.0\/16/' /etc/chrony.conf"
    238. ssh root@${host_address[j]} "sed -i 's/#local stratum 10/local stratum 10/' /etc/chrony.conf"
    239. sleep 2
    240. else
    241. ssh root@${host_address[j]} "sed -i '2a\server '"${host_address[0]}"' iburst\' /etc/chrony.conf"
    242. fi
    243. ssh root@${host_address[j]} "systemctl restart chronyd && systemctl enable chronyd &> /dev/null"
    244. sleep 5
    245. ssh root@${host_address[j]} "timedatectl set-ntp true && chronyc sources -v | sed -n '/^\^\*/p'"
    246. if [ -z "`ssh root@${host_address[j]} "chronyc sources -v | sed -n '/^\^\*/p'"`" ];then
    247. echo -e "\e[31m此节点${host_address[j]}的chrony配置有误,请手动调试\e[0m"
    248. exit
    249. fi
    250. echo "############# ${host_address[j]}配置完毕 #############"
    251. done
    252. break
    253. elif [ "${flag}" == "n" ];then
    254. echo "############# 已跳过步骤-配置chrony时间服务器 #############"
    255. break
    256. elif [ ${i} -eq 99 ];then
    257. echo "############# 已退出 #############"
    258. exit
    259. else continue;fi
    260. done
    261. # 安装GPFS软件
    262. for ((i=0;i<100;i++));do
    263. read -p "是否安装gpfs软件?(Y/n): " flag
    264. if [ "${flag}" == "Y" ];then
    265. sleep 3
    266. read -p "请输入你上传到本机的gpfs的(父目录绝对路径)/gpfs*.rpm: " install_path
    267. for ((j=0;j<2;j++));do
    268. echo "########################## ${host_address[j]}开始卸载lustre ##########################"
    269. ssh root@${host_address[j]} "rpm -e gpfs.gskit-8.0.50-86.x86_64"
    270. ssh root@${host_address[j]} "rpm -e gpfs.docs-4.2.3-22.noarch"
    271. ssh root@${host_address[j]} "rpm -e gpfs.msg.en_US-4.2.3-22.noarch"
    272. ssh root@${host_address[j]} "rpm -e gpfs.ext-4.2.3-22.x86_64"
    273. ssh root@${host_address[j]} "rpm -e gpfs.gpl-4.2.3-22.noarch"
    274. ssh root@${host_address[j]} "rpm -e gpfs.base-4.2.3-22.x86_64"
    275. echo "############# ${host_address[j]}卸载完毕 #############"
    276. echo "########################## ${host_address[j]}rpm开始被复制过来 ##########################"
    277. ssh root@${host_address[j]} "rm -rf ~/gpfs-4.2.3-22 && mkdir ~/gpfs-4.2.3-22"
    278. scp ${install_path}/gpfs*.rpm root@${host_address[j]}:~/gpfs-4.2.3-22
    279. if [ `echo $?` != 0 ];then
    280. echo "复制失败,请手动排错!"
    281. exit
    282. fi
    283. echo "############# ${host_address[j]}复制完毕 #############"
    284. echo "########################## ${host_address[j]}开始安装依赖 ##########################"
    285. ssh root@${host_address[j]} "yum -y install make perl rsh ld-linux.so libm.so.6 libc.so.6 ksh libstdc++.so.5 rsh-server rpcbind xinetd libaio cpp gcc-c++ gcc nfs-utils kernel-headers compat-libstdc++ glibc-devel libXp.so.6 imake rpm-build rpm-build m4 python3"
    286. ssh root@${host_address[j]} "yum install -y bash-completion vim net-tools tree psmisc lrzsz dos2unix"
    287. ssh root@${host_address[j]} "yum install iproute -y"
    288. if [ `echo $?` != 0 ];then
    289. echo "安装失败,请手动排错!"
    290. exit
    291. fi
    292. echo "############# ${host_address[j]}安装完毕 #############"
    293. echo "########################## ${host_address[j]}开始安装gpfs ##########################"
    294. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.base-4.2.3-22.x86_64.rpm"
    295. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.docs-4.2.3-22.noarch.rpm"
    296. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.gpl-4.2.3-22.noarch.rpm"
    297. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.gskit-8.0.50-86.x86_64.rpm"
    298. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.msg.en_US-4.2.3-22.noarch.rpm"
    299. ssh root@${host_address[j]} "rpm -ivh ~/gpfs-4.2.3-22/gpfs.ext-4.2.3-22.x86_64.rpm"
    300. if [ `echo $?` != 0 ];then
    301. echo "安装失败,请手动排错!"
    302. exit
    303. fi
    304. echo "############# ${host_address[j]}配置完毕 #############"
    305. done
    306. break
    307. elif [ "${flag}" == "n" ];then
    308. echo "############# 已跳过步骤-安装GPFS软件 #############"
    309. break
    310. elif [ ${i} -eq 99 ];then
    311. echo "############# 已退出 #############"
    312. exit
    313. else continue;fi
    314. done
    315. # 编译gpfs
    316. for ((i=0;i<100;i++));do
    317. read -p "是否编译GPFS?(Y/n): " flag
    318. if [ "${flag}" == "Y" ];then
    319. sleep 3
    320. for ((j=0;j<2;j++));do
    321. echo "########################## ${host_address[j]}开始处理编译问题 ##########################"
    322. if [ -z `ssh root@${host_address[j]} "rpm -qa | grep kernel" | grep "kernel-devel-3.10.0-1160.el7.x86_64"` ];then
    323. ssh root@${host_address[j]} "wget http://mirror.centos.org/centos/7/os/x86_64/Packages/kernel-devel-3.10.0-1160.el7.x86_64.rpm"
    324. ssh root@${host_address[j]} "rpm -Uvh kernel-devel-3.10.0-1160.el7.x86_64.rpm --force"
    325. fi
    326. ssh root@${host_address[j]} "sed -i '122s/*/unsigned long __x86_return_thunk;/' /usr/lpp/mmfs/src/gpl-linux/kdump.c"
    327. echo "############# ${host_address[j]}处理完毕 #############"
    328. echo "########################## ${host_address[j]}开始编译gpfs ##########################"
    329. ssh root@${host_address[j]} "cd /usr/lpp/mmfs/src && make Autoconfig LINUX_DISTRIBUTION=REDHAT_AS_LINUX && make World"
    330. if [ `echo $?` != 0 ];then
    331. echo "编译失败,请手动排错!"
    332. exit
    333. fi
    334. ssh root@${host_address[j]} "cd /usr/lpp/mmfs/src && make rpm" | grep "^Wrote:" > ~/rpm.test
    335. gplbin_path=`grep "Wrote" ~/rpm.test | awk -F ': ' '{print $2}'`
    336. ssh root@${host_address[j]} "rpm -Uvh ${gplbin_path} --force"
    337. if [ `echo $?` != 0 ];then
    338. echo "编译失败,请手动排错!"
    339. exit
    340. fi
    341. echo "############# ${host_address[j]}编译完成 #############"
    342. ssh root@${host_address[j]} "source /etc/profile;mmcrcluster"
    343. if [ `echo $?` != 1 ];then
    344. echo "########################## ${host_address[j]}配置环境变量 ##########################"
    345. ssh root@${host_address[j]} "echo 'export PATH=$PATH:/usr/lpp/mmfs/bin' >> /etc/profile"
    346. sleep 3
    347. ssh root@${host_address[j]} "source /etc/profile"
    348. echo "############# ${host_address[j]}环境变量配置完毕 #############"
    349. fi
    350. echo "############# ${host_address[j]}配置完毕 #############"
    351. done
    352. break
    353. elif [ "${flag}" == "n" ];then
    354. echo "############# 已跳过步骤-编译GPFS #############"
    355. break
    356. elif [ ${i} -eq 99 ];then
    357. echo "############# 已退出 #############"
    358. exit
    359. else continue;fi
    360. done
    361. # 创建集群并启动
    362. for ((i=0;i<100;i++));do
    363. read -p "是否创建集群并启动?(Y/n): " flag
    364. if [ "${flag}" == "Y" ];then
    365. sleep 3
    366. echo "########################## 开始创建集群 ##########################"
    367. if [ -z "`ssh root@${host_address[0]} "source /etc/profile && mmlscluster" | grep 'GPFS cluster name:' | grep "${gpfs_cluster_name}"`" ];then
    368. ssh root@${host_address[0]} "echo -n > ~/gpfsfile"
    369. for ((j=0;j<2;j++));do
    370. ssh root@${host_address[0]} "echo '${host_address[j]}:quorum-manager' >> ~/gpfsfile"
    371. done
    372. ssh root@${host_address[0]} "source /etc/profile && mmcrcluster -N ~/gpfsfile -p ${host_hostname[0]} -s ${host_hostname[1]} -r /usr/bin/ssh -R /usr/bin/scp -A -C ${gpfs_cluster_name}"
    373. if [ `echo $?` != 0 ];then
    374. echo "失败,请手动排错!"
    375. exit
    376. fi
    377. else
    378. echo "########################## 名为gpfs的集群已创建 ##########################"
    379. fi
    380. echo "#################################################################"
    381. echo "########################## 查看集群节点 ##########################"
    382. ssh root@${host_address[0]} "source /etc/profile && mmlscluster"
    383. echo "#################################################################"
    384. echo "#################################################################"
    385. echo "########################## 启动集群并查看集群状态 ##########################"
    386. ssh root@${host_address[0]} "source /etc/profile && mmstartup -a && mmgetstate -Lsa"
    387. if [ `echo $?` != 0 ];then
    388. echo "失败,请手动排错!"
    389. exit
    390. fi
    391. echo "#################################################################"
    392. echo "#################################################################"
    393. echo "############# 配置完毕 #############"
    394. break
    395. elif [ "${flag}" == "n" ];then
    396. echo "############# 已跳过步骤-创建集群并启动 #############"
    397. break
    398. elif [ ${i} -eq 99 ];then
    399. echo "############# 已退出 #############"
    400. exit
    401. else continue;fi
    402. done
    403. # 创建NSD磁盘
    404. for ((i=0;i<100;i++));do
    405. read -p "是否创建NSD磁盘?(Y/n): " flag
    406. if [ "${flag}" == "Y" ];then
    407. sleep 3
    408. echo "########################## 开始创建NSD磁盘 ##########################"
    409. if [ -z "`ssh root@${host_address[0]} "source /etc/profile && mmlsnsd -m" | grep -E '(NSD_1|NSD_2)'`" ];then
    410. ssh root@${host_address[0]} "echo -n > ~/nsd.node"
    411. for ((j=0;j<${#nsd_name[*]};j++));do
    412. ssh root@${host_address[0]} "cat << eof >> ~/nsd.node
    413. %nsd: nsd=${nsd_name[j]}
    414. device=/dev/${nsd_device[j]}
    415. servers=${hostname_douhao}
    416. usage=dataAndMetadata
    417. failureGroup=100
    418. pool=system
    419. eof"
    420. done
    421. ssh root@${host_address[0]} "source /etc/profile && mmcrnsd -F ~/nsd.node -v no"
    422. if [ `echo $?` != 0 ];then
    423. echo "失败,请手动排错!"
    424. exit
    425. fi
    426. else
    427. echo "########################## NSD磁盘已创建 ##########################"
    428. fi
    429. echo "#################################################################"
    430. echo "########################## 查看NSD磁盘 ##########################"
    431. ssh root@${host_address[0]} "source /etc/profile && mmlsnsd -m"
    432. echo "#################################################################"
    433. echo "#################################################################"
    434. echo "########################## 配置仲裁盘 ##########################"
    435. ssh root@${host_address[0]} "source /etc/profile && mmchconfig tiebreakerDisks='${hostname_fenhao}' && mmlsconfig"
    436. if [ `echo $?` != 0 ];then
    437. echo "失败,请手动排错!"
    438. exit
    439. fi
    440. echo "############# 配置完毕 #############"
    441. break
    442. elif [ "${flag}" == "n" ];then
    443. echo "############# 已跳过步骤-创建NSD磁盘 #############"
    444. break
    445. elif [ ${i} -eq 99 ];then
    446. echo "############# 已退出 #############"
    447. exit
    448. else continue;fi
    449. done
    450. # 创建文件系统并且挂载
    451. for ((i=0;i<100;i++));do
    452. read -p "是否创建NSD磁盘?(Y/n): " flag
    453. if [ "${flag}" == "Y" ];then
    454. sleep 3
    455. echo "########################## 开始创建NSD磁盘 ##########################"
    456. if [ -z "`ssh root@${host_address[0]} "source /etc/profile && mmlsconfig" | sed -n '/^File systems/,${p}' | grep "${file_system_name}"`" ];then
    457. ssh root@${host_address[0]} "source /etc/profile && mmcrfs /${file_system_name} /dev/${file_system_name} -F ~/nsd.node -A yes -B 512k -m 1 -M 2 -r 1 -R 2 -n 512 -j cluster -Q yes"
    458. if [ `echo $?` != 0 ];then
    459. echo "失败,请手动排错!"
    460. exit
    461. fi
    462. else
    463. echo "########################## gpfs1文件系统已创建 ##########################"
    464. fi
    465. echo "#################################################################"
    466. echo "########################## 查看NSD磁盘 ##########################"
    467. ssh root@${host_address[0]} "source /etc/profile && mmlsconfig"
    468. echo "#################################################################"
    469. echo "#################################################################"
    470. echo "########################## 挂载文件系统 ##########################"
    471. ssh root@${host_address[0]} "source /etc/profile && mmmount all -a && mmlsmount gpfs1 -L"
    472. if [ `echo $?` != 0 ];then
    473. echo "失败,请手动排错!"
    474. exit
    475. fi
    476. echo "############# 配置完毕 #############"
    477. break
    478. elif [ "${flag}" == "n" ];then
    479. echo "############# 已跳过步骤-创建文件系统并且挂载 #############"
    480. break
    481. elif [ ${i} -eq 99 ];then
    482. echo "############# 已退出 #############"
    483. exit
    484. else continue;fi
    485. done

  • 相关阅读:
    智能穿戴显示屏怎样操作?智能穿戴显示屏具有怎么功能?
    一文读懂二级分销返利模式,商城系统源码机制分享
    GET和POST两种基本请求方法最基本的区别(非常全面)
    纳米软件介绍什么是LABVIEW?
    svn迁移到git实际操作(亲测有效)
    Live800:避开客服雷区,提升客服转化
    nginx实现https与http共存方案
    用大模型实现PPT可视化几种思路
    linux环境执行jar脚本
    Redis 统计用户新增和留存
  • 原文地址:https://blog.csdn.net/qq_56776641/article/details/133942320