-
Notifications
You must be signed in to change notification settings - Fork 2
/
reset.sh
124 lines (104 loc) · 3.74 KB
/
reset.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
handy_ip=55.149.1.83
node_ip=(55.149.1.83 55.149.1.85 55.149.1.86) # 节点列表
echo "[INFO]Handy ip: $handy_ip"
echo "[INFO]Node ip :"
for var in ${node_ip[@]}
do
echo $var
done
echo '[INFO]stop daos server...'
systemctl stop daos_server.service
for var in ${node_ip[@]}
do
ssh -q root@$var "systemctl stop daos_server.service"
done
echo '[INFO]umount daos0...'
umount /mnt/daos0
for var in ${node_ip[@]}
do
ssh -q root@$var "umount /mnt/daos0"
done
echo '[INFO]umount daos1...'
umount /mnt/daos1
for var in ${node_ip[@]}
do
ssh -q root@$var "umount /mnt/daos1"
done
echo '[INFO]format pmem0...'
wipefs -a /dev/pmem0
for var in ${node_ip[@]}
do
ssh -q root@$var "wipefs -a /dev/pmem0"
done
echo '[INFO]format pmem1...'
wipefs -a /dev/pmem1
for var in ${node_ip[@]}
do
ssh -q root@$var "wipefs -a /dev/pmem1"
done
echo '[INFO]start daos server...'
systemctl start daos_server.service
for var in ${node_ip[@]}
do
ssh -q root@$var "systemctl start daos_server.service"
done
#echo 'prepare scm ...'
#/opt/h3c/bin/daos_server storage prepare --scm-only
#ssh -q root@$node_ip1 "/opt/h3c/bin/daos_server storage prepare --scm-only"
#ssh -q root@$node_ip2 "/opt/h3c/bin/daos_server storage prepare --scm-only"
#echo 'restart daos server...'
#systemctl restart daos_server.service
#ssh -q root@$node_ip1 "systemctl restart daos_server.service"
#ssh -q root@$node_ip2 "systemctl restart daos_server.service"
#echo 'prepare scm...'
#/opt/h3c/bin/daos_server storage prepare --scm-only
#ssh -q root@$node_ip1 "/opt/h3c/bin/daos_server storage prepare --scm-only"
#ssh -q root@$node_ip2 "/opt/h3c/bin/daos_server storage prepare --scm-only"
#echo 'prepare nvme...'
#/opt/h3c/bin/daos_server storage prepare --nvme-only -u root
#ssh -q root@$node_ip1 "/opt/h3c/bin/daos_server storage prepare --nvme-only -u root"
#ssh -q root@$node_ip2 "/opt/h3c/bin/daos_server storage prepare --nvme-only -u root"
echo '[INFO]restart daos agent...'
systemctl restart daos_agent.service
for var in ${node_ip[@]}
do
ssh -q root@$var "systemctl restart daos_agent.service"
done
sleep 10
/opt/h3c/bin/dmg storage format
echo '[INFO] Datebase initializing...'
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from op_blk_lunmng"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from op_cluster_pool"
sleep 2
echo '[INFO]Datebase initialization complete'
echo '[INFO]start reset tgt db...'
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_ha_info"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_ha_slaves"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_chap"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_chap_initiator"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_hg_host"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_host_group"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_host_group_relate_port"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_initiator"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_initiator_mapping"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_lun_mapping"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_lun_target"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_node_status"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_target"
mariadbsql -ucalamari -p27HbZwr*g calamari -e "delete from tgt_host"
sleep 2
rm -f /etc/keepalived/keepalived.conf
service keepalived stop
for var in ${node_ip[@]}
do
ssh -q root@$var "rm -f /etc/keepalived/keepalived.conf"
ssh -q root@$var "service keepalived stop"
done
echo '[INFO]restart tgt...'
service tgt restart
for var in ${node_ip[@]}
do
ssh -q root@$var "service tgt restart"
done
echo '[INFO]OK! Now you can operate the cluster'