42n4

GlusterXenserver43servers

Mar 2nd, 2016
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 21.29 KB | None | 0 0
  1. #USE IT IN COMMAND LINE (without #):
  2. #curl  http://pastebin.com/raw/mKn0ArbQ > xenglusterfs.sh; tr -d "\015" < xenglusterfs.sh > xenglusterfsnew.sh
  3. #sh xenglusterfsnew.sh
  4. #I have managed to configure 4 servers of beta3 dundee with glusterfs and ctdb and fully working ha without SPOF.
  5. #I have four NICs: NIC0 management of xenserver 192.168.10.2*, NIC1 gluster vm client 192.168.10.14*, bond NIC2-3 10.10.10.1*, VIPs #from ctdb 192.168.10.13*. In /etc/hosts I keep only 10.10.10.1x server ips and use them in glusterfs volume creation and in #consequence in glusterfs backend traffic.
  6. #The main compilation script:
  7. #http://pastebin.com/mKn0ArbQ
  8. #Removing local storage and configuring ctdb, /etc/hosts:
  9. #http://pastebin.com/vfhyM0xu
  10. #At the end you should:
  11. #gluster peer probe servers and
  12. #init_gluster4 "xenserverhw" "06" "08" "03" "04" "vol0" 4 #replica 4 at the end!
  13. #create SR nfs and iso, make vm and install xen tools and enable ha with 3 failovers.
  14. #You are encouraged to send some patches or opinions newfuntek(at)gmail.com
  15. #Here are some screenshots of the glusterfs sr in the xenserver pool:
  16. #http://s19.postimg.org/4pr7i3m2r/glusterfsxenserv01.jpg
  17. #http://s19.postimg.org/g0tv6gsxv/glusterfsxenserv02.jpg
  18. #http://s19.postimg.org/fzjxd1r43/glusterfsxenserv03.jpg
  19. #Internet help
  20. #Xenserver doc links
  21. #http://www.poppelgaard.com/citrix-xenserver-6-5
  22. #http://www.gluster.org/community/documentation/index.php/GlusterFS_Documentation
  23. #xenserver tutorials and cheatsheets
  24. #http://www.admin-magazine.com/HPC/Articles/GlusterFS
  25. #http://www.slashroot.in/gfs-gluster-file-system-complete-tutorial-guide-for-an-administrator
  26. #https://virtualizationandstorage.wordpress.com/2010/11/15/xenserver-commands/
  27. #http://krypted.com/unix/using-the-xensource-command-line-interface/
  28. #http://funwithlinux.net/2013/02/glusterfs-tips-and-tricks-centos/
  29. #http://xmodulo.com/category/xenserver
  30. #compilation of xenserver
  31. #https://discussions.citrix.com/topic/372069-does-libvmi-work-on-xenserver/
  32. #glusterfs slides info
  33. #http://rajesh-joseph.blogspot.com/2015/11/usenix-lisa-2015-tutorial-on-glusterfs.html
  34. #https://github.com/gluster/gluster-tutorial/blob/master/LISA-GlusterFS-Introduction.pdf
  35. #https://github.com/gluster/gluster-tutorial/blob/master/LISA-GlusterFS-Hands-on.pdf
  36. #compilation of glusterfs
  37. #http://majentis.com/?p=319
  38. #różne możliwości glusterfs jak w RAID
  39. #http://sysadm.pp.ua/linux/glusterfs-setup.html
  40. #glusterfs performance
  41. #https://blog.secretisland.de/xenserver-mit-glusterfs/
  42. #http://blog.dradmin.co.in/?tag=glusterfs-how-to
  43. #https://gluster.readthedocs.org/en/latest/Administrator%20Guide/Managing%20Volumes/
  44. #https://www.mail-archive.com/users@ovirt.org/msg31079.html
  45. #http://www.gluster.org/community/documentation/index.php/Performance_Testing
  46. #glusterfs on lvm
  47. #https://support.rackspace.com/how-to/getting-started-with-glusterfs-considerations-and-installation/
  48. #glusterfs profiling (delays in ops)
  49. #https://gluster.readthedocs.org/en/latest/Administrator%20Guide/Monitoring%20Workload/
  50. #xenserver glusterfs discussion - they said not possible ;)
  51. #http://discussions.citrix.com/topic/366729-about-xenserver-glusterfs/page-2
  52. #xenserver ha
  53. #http://docs.citrix.com/de-de/xencenter/6-1/xs-xc-protection/xs-xc-pools-ha/xs-xc-pools-ha-about.html
  54. #http://xapi-project.github.io/features/HA/HA.html
  55. #https://support.citrix.com/servlet/KbServlet/download/21018-102-664364/High%20Availability%20for%20Citrix%20XenServer.pdf
  56. #https://xen-orchestra.com/blog/xenserver-and-vm-high-availability/
  57. #https://discussions.citrix.com/topic/367150-ntp-ha-self-fencing/page-2#entry1884695
  58. #http://discussions.citrix.com/topic/333343-need-help-interpreting-xha-logs/
  59. #failure ha restart
  60. #http://support.citrix.com/article/CTX128275
  61. #http://citrixtechs.com/blog/help-my-citrix-xenserver-poolmaster-is-down-2/
  62. #http://discussions.citrix.com/topic/292757-local-storage-unplugged-and-un-repairable/
  63. #xenserver iscsi
  64. #http://gluster.readthedocs.org/en/latest/Administrator%20Guide/GlusterFS%20iSCSI/#Running_the_target_on_the_gluster_client
  65. #xenserver multipath
  66. #http://docs.citrix.com/content/dam/docs/en-us/xenserver/xenserver-61/xs-design-multipathing-config.pdf
  67. #xenserver iptables discussion
  68. #http://discussions.citrix.com/topic/235974-cannot-add-new-nfs-virtual-disk-sr-can-add-iso-library-nfs-sr/page-2
  69. #rebalance nics (bond for glusterfs)
  70. #http://www.gluster.org/pipermail/gluster-users/2014-November/019463.html
  71. #http://www.gluster.org/pipermail/gluster-users/2014-November/019466.html
  72. #multi nic splitnetwork for gluster in near future
  73. #https://www.gluster.org/pipermail/gluster-users/2015-May/021815.html
  74. #http://www.gluster.org/community/documentation/index.php/Features/SplitNetwork
  75. #http://pl.atyp.us/hekafs.org/index.php/2013/01/split-and-secure-networks-for-glusterfs/
  76. #host in vm inside vm config
  77. #https://wiki.openstack.org/wiki/XenServer/VirtualBox
  78. #reinstall xenserver host
  79. #http://support.citrix.com/article/CTX136342
  80. #discuss rejoin xenserver
  81. #http://discussions.citrix.com/topic/303468-server-removed-from-pool-after-failure-now-that-it-is-back-it-can-not-rejoin-pool-and-emergency-master-reset-does-not-work/
  82. #increase dom0 memory
  83. #http://support.citrix.com/article/CTX134951
  84. #find rpm
  85. #http://rpm.pbone.net/
  86. #win admin
  87. #win7-10: Net user administrator /active:yes
  88. #umount /dev/v/l
  89. #e2fsck -f /dev/v/l
  90. #resize2fs -p /dev/v/l 4G
  91. #lvreduce -L -8.9G /dev/
  92.  
  93. #turn off nfs i iptables
  94. chkconfig nfs off
  95. service nfs stop
  96. rm -f /etc/exports
  97. service ntpd restart
  98. chkconfig ntpd on
  99. service iptables stop
  100. chkconfig iptables off
  101.  
  102.  
  103. #new package update lists
  104. #https://discussions.citrix.com/topic/372069-does-libvmi-work-on-xenserver/
  105. #yum install epel-release
  106. #http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/
  107. #http://elrepo.org/tiki/tiki-index.php
  108. rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  109. rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
  110. wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
  111. rpm -ivh epel-release-7-5.noarch.rpm
  112. rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
  113. rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  114. rpm -Uvh http://repo.webtatic.com/yum/el7/webtatic-release.rpm
  115. #sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/epel-testing.repo
  116. sed -i -e "/baseurl=http:\/\/www.uk/d" /etc/yum.repos.d/CentOS-Base.repo
  117. sed -i -e "/mirrorlist/d" /etc/yum.repos.d/CentOS-Base.repo
  118. sed -i -e "s/^#base/base/" /etc/yum.repos.d/CentOS-Base.repo
  119. sed -i -e "s/enabled=0/enabled=1/" /etc/yum.repos.d/CentOS-Base.repo
  120. sed -i -e "s/\$releasever/7/" /etc/yum.repos.d/CentOS-Base.repo
  121. #sed -i -e "s/enabled=1/enabled=0/" /etc/yum.repos.d/Citrix.repo
  122.  
  123. yum clean all
  124. yum repolist enabled
  125. yum -y install deltarpm
  126. yum -y install vim-enhanced mc yum-utils curl e4fsprogs epel-rpm-macros
  127. curl ix.io/client > /usr/local/bin/ix
  128. chmod +x /usr/local/bin/ix
  129.  
  130. #update systemu i dodatkowe pakiety potrzebne do kompilacji glusterfs (mogą być jakieś nadmiarowe)
  131. yum update --skip-broken -y
  132. #yum upgrade
  133. yum install gcc make automake git bison flex python-ctypes fusermount readline rpm-build libibverbs-devel gcc-c++ libtool dev86 mock texinfo -y
  134. useradd -s /sbin/nologin mockbuild
  135. yum install -y scsi-target-utils samba nc tdb-tools cmake python-lxml gtk-doc gperf intltool docbook-style-xsl tree firewalld
  136. #yum install targetcli targetd -y
  137. yum install -y e2fsprogs-devel openssl-devel yajl-devel libaio-devel cairo-devel python-devel uuid-devel glib2-devel lzma-devel xz-compat-libs libacl-devel sqlite-devel libxml2-devel userspace-rcu-devel readline-devel librdmacm-devel fuse-devel lvm2 audit-libs-devel gettext-devel pam-devel popt-devel libutempter-devel libuser-devel libcap-ng-devel json-c-devel libestr-devel python-docutils ibgcrypt-devel libcurl-devel libee-devel liblognorm-devel libdbi-devel mysql mysql-devel postgresql-devel librelp-devel gnutls-devel net-snmp-devel libnet-devel attr dlm-devel sanlock-devel corosynclib-devel resource-agents libgcrypt-devel libtalloc-devel libtdb-devel libtevent-devel libmount-devel libmicrohttpd-devel  qrencode-devel kmod-devel  libidn-devel libblkid-devel  gobject-introspection-devel pciutils-devel dbus-devel libcap-devel libpwquality-devel libntirpc-devel libnfsidmap-devel PyQt4-devel  xfsprogs-devel  glusterfs-api-devel python-gluster
  138. yum update --skip-broken -y
  139.  
  140. #kompilacja util-linux, rsyslog, lvm2, gdyż nie udało się dodanie pakietów z devel
  141. #dodamy devel skompilowane, aby skompilować glusterfs
  142. echo "%__make /usr/bin/make -j 8" > ~/.rpmmacros
  143. cd
  144.  
  145. wget http://downloadns.citrix.com.edgesuite.net/11441/XenServer-6.6.92-source.iso
  146. mkdir iso
  147. mount XenServer-6.6.92-source.iso iso
  148. #rm rpmbuild/ -rf; rpm -ivh iso/kernel-3.10.96-479.383024.src.rpm
  149. #rpmbuild -ba rpmbuild/SPECS/kernel.spec
  150. #mv rpmbuild/ rpmbuild.kernel -f
  151.  
  152. wget ftp://fr2.rpmfind.net/linux/centos/7.2.1511/os/x86_64/Packages/systemd-devel-219-19.el7.x86_64.rpm
  153. rpm -ivh systemd-devel-219-19.el7.x86_64.rpm --nodeps
  154.  
  155. rpm -ivh iso/lvm2-2.02.130-5.el7_2.1.xs7.src.rpm
  156. rpmbuild -ba rpmbuild/SPECS/lvm2.spec
  157. cd rpmbuild/RPMS/x86_64
  158. yum localinstall *.rpm -y
  159. cd
  160. mv rpmbuild rpmbuild-lvm2 -f
  161. sed -i -e "s/metadata_read_only = 1/metadata_read_only = 0/" /etc/lvm/lvm.conf
  162.  
  163. rpm -ivh iso/cryptsetup-1.6.7-1.el7.src.rpm
  164. rpmbuild -ba rpmbuild/SPECS/cryptsetup.spec
  165. cd rpmbuild/RPMS/x86_64
  166. yum localinstall *.rpm -y
  167. cd
  168. mv rpmbuild rpmbuild-crypt -f
  169.  
  170. rpm -ivh iso/systemd-219-19.el7_2.4.xs3.src.rpm
  171. rpmbuild -ba rpmbuild/SPECS/systemd.spec
  172. cd rpmbuild/RPMS/x86_64
  173. yum localinstall *.rpm -y
  174. cd
  175. mv rpmbuild rpmbuild-systemd -f
  176.  
  177. #wget http://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/CentOS/epel-7.2/SRPMS/glusterfs-${gfsversion}.el7.src.rpm
  178. gfsversion="3.7.9-1"
  179. wget http://download.gluster.org/pub/gluster/glusterfs/3.7/LATEST/CentOS/epel-7.2/SRPMS/glusterfs-${gfsversion}.el7.src.rpm
  180. rpm -ivh glusterfs-${gfsversion}.el7.src.rpm
  181. rpmbuild -ba rpmbuild/SPECS/glusterfs.spec
  182. cd rpmbuild/RPMS/x86_64/
  183. #yum localinstall -y glusterfs-3.7.9-1.el7.centos.x86_64.rpm glusterfs-api-3.7.9-1.el7.centos.x86_64.rpm glusterfs-api-devel-3.7.9-1.el7.centos.x86_64.rpm glusterfs-cli-3.7.9-1.el7.centos.x86_64.rpm glusterfs-client-xlators-3.7.9-1.el7.centos.x86_64.rpm glusterfs-debuginfo-3.7.9-1.el7.centos.x86_64.rpm glusterfs-devel-3.7.9-1.el7.centos.x86_64.rpm glusterfs-extra-xlators-3.7.9-1.el7.centos.x86_64.rpm glusterfs-fuse-3.7.9-1.el7.centos.x86_64.rpm glusterfs-libs-3.7.9-1.el7.centos.x86_64.rpm glusterfs-rdma-3.7.9-1.el7.centos.x86_64.rpm glusterfs-server-3.7.9-1.el7.centos.x86_64.rpm
  184. rpm -ivh glusterfs-3.7.9-1.el7.centos.x86_64.rpm glusterfs-api-3.7.9-1.el7.centos.x86_64.rpm glusterfs-api-devel-3.7.9-1.el7.centos.x86_64.rpm glusterfs-cli-3.7.9-1.el7.centos.x86_64.rpm glusterfs-client-xlators-3.7.9-1.el7.centos.x86_64.rpm glusterfs-debuginfo-3.7.9-1.el7.centos.x86_64.rpm glusterfs-devel-3.7.9-1.el7.centos.x86_64.rpm glusterfs-extra-xlators-3.7.9-1.el7.centos.x86_64.rpm glusterfs-fuse-3.7.9-1.el7.centos.x86_64.rpm glusterfs-libs-3.7.9-1.el7.centos.x86_64.rpm glusterfs-rdma-3.7.9-1.el7.centos.x86_64.rpm glusterfs-server-3.7.9-1.el7.centos.x86_64.rpm --nodeps --force
  185. cd
  186. mv rpmbuild rpmbuild-glusterfs -f
  187.  
  188. wget http://cbs.centos.org/kojifiles/packages/nfs-ganesha/2.3.0/1.el7/src/nfs-ganesha-2.3.0-1.el7.src.rpm
  189. rpm -ivh nfs-ganesha-2.3.0-1.el7.src.rpm
  190. rpmbuild -ba rpmbuild/SPECS/nfs-ganesha.spec
  191. cd rpmbuild/RPMS/x86_64
  192. yum localinstall *.rpm -y
  193. cd
  194. mv rpmbuild rpmbuild-nfsganesha -f
  195.  
  196. cd rpmbuild-glusterfs/RPMS/x86_64
  197. yum localinstall -y glusterfs-ganesha-3.7.9-1.el7.centos.x86_64.rpm glusterfs-geo-replication-3.7.9-1.el7.centos.x86_64.rpm
  198. cd
  199.  
  200. #uruchomienie serwisu glusterfs
  201. systemctl unmask rpcbind.socket
  202. service glusterd start
  203. service glusterd status
  204. service glusterfsd start
  205. service glusterfsd status
  206. chkconfig glusterd on
  207. chkconfig glusterfsd on
  208.  
  209. mkdir rpmbuild/SPECS -p; curl http://ix.io/oh7 > rpmbuild/SPECS/ctdb.spec
  210. wget https://download.samba.org/pub/ctdb/ctdb-2.5.5.tar.gz -P rpmbuild/SOURCES
  211. yum install libtalloc-devel libtdb-devel libtevent-devel nc tdb-tools samba -y
  212. rpmbuild -bp rpmbuild/SPECS/ctdb.spec
  213. sed -i "s/SCHED_FIFO/SCHED_OTHER/"  rpmbuild/BUILD/ctdb-2.5.5/common/system_util.c  
  214. sed -i "s/p.sched_priority = 1/p.sched_priority = 0/"  rpmbuild/BUILD/ctdb-2.5.5/common/system_util.c  
  215. rpmbuild -bc --short-circuit  rpmbuild/SPECS/ctdb.spec --noclean
  216. rpmbuild -bi --short-circuit  rpmbuild/SPECS/ctdb.spec --noclean
  217. rpmbuild -bb --short-circuit  rpmbuild/SPECS/ctdb.spec --noclean
  218. rpm -ivh rpmbuild/RPMS/x86_64/ctdb-* --nodeps --force
  219. mv rpmbuild rpmbuild-ctdb -f
  220. sed -i "s/^# CTDB_LOGFILE/CTDB_LOGFILE/" /etc/sysconfig/ctdb
  221. sed -i "s/^# CTDB_NODES/CTDB_NODES/" /etc/sysconfig/ctdb  
  222. sed -i "s/^CTDB_RECOVERY_LOCK/# CTDB_RECOVERY_LOCK/" /etc/sysconfig/ctdb
  223. sed -i 's/Restart=no/Restart=always/' /usr/lib/systemd/system/ctdb.service
  224. service smb stop
  225. chkconfig smb off
  226.  
  227. wget http://halizard.org/release/noSAN-combined/halizard_nosan_installer_1.4.7
  228. chmod 755 halizard_nosan_installer_1.4.7  
  229. sed -i 's/`uname -r`/3.10.0+2/' halizard_nosan_installer_1.4.7
  230.  
  231. sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/sysconfig/selinux
  232. #curl http://ix.io/oxr > /etc/ntp.conf.ix
  233. #curl http://ix.io/ojO > /etc/ntp.conf.ix
  234. #gluster10
  235. #curl http://ix.io/op8 > /etc/ntp.conf.ix
  236. #gluster200_201
  237. #curl http://ix.io/oKN > /etc/ntp.conf.ix
  238. #gluster201_202_203
  239. curl http://ix.io/uLn > /etc/ntp.conf.ix
  240. tr -d "\015" < /etc/ntp.conf.ix > /etc/ntp.conf
  241. echo OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -x" > /etc/sysconfig/ntpd
  242. echo SYNC_HWCLOCK=yes >> /etc/sysconfig/ntpd
  243. service ntpd stop
  244. service ntpd start
  245. ntpstat -s
  246. ntpq -p
  247. ntpstat -s
  248.  
  249. echo "#/opt/xensource/bin/xe-toolstack-restart" >> /etc/rc.d/rc.local
  250. echo "service glusterd restart" >> /etc/rc.d/rc.local
  251. echo "service glusterfsd restart" >> /etc/rc.d/rc.local
  252. echo "service ctdb restart" >> /etc/rc.d/rc.local
  253. chmod 755  /etc/rc.d/rc.local
  254.  
  255. echo "xe host-emergency-ha-disable force=true" > /usr/local/bin/restartfence
  256. echo "/opt/xensource/bin/xe-toolstack-restart" >> /usr/local/bin/restartfence
  257. echo "service glusterd restart" >> /usr/local/bin/restartfence
  258. echo "service glusterfsd restart" >> /usr/local/bin/restartfence
  259. echo "service ctdb restart" >> /usr/local/bin/restartfence  
  260. chmod 755 /usr/local/bin/restartfence
  261.  
  262. echo "/opt/xensource/bin/xe-toolstack-restart" >> /usr/local/bin/restartoolxen
  263. echo "service glusterd restart" >> /usr/local/bin/restartoolxen
  264. echo "service glusterfsd restart" >> /usr/local/bin/restartoolxen
  265. echo "service ctdb restart" >> /usr/local/bin/restartoolxen
  266. chmod 755 /usr/local/bin/restartoolxen
  267.  
  268. echo "service glusterd restart" > /usr/local/bin/restartdodatki
  269. echo "service glusterfsd restart" >> /usr/local/bin/restartdodatki
  270. echo "service ctdb restart" >> /usr/local/bin/restartdodatki
  271. chmod 755 /usr/local/bin/restartdodatki
  272.  
  273. echo "service glusterd restart" > /usr/local/bin/restartgluster
  274. echo "service glusterfsd restart" >> /usr/local/bin/restartgluster
  275. chmod 755 /usr/local/bin/restartgluster
  276.  
  277. #init_gluster4 "xenserverhw" "06" "08" "03" "04" "vol0" 4
  278. #server="xenserverhw"; host01="06"; host02="08"; host03="03"; host04="04"; volume="vol0"; replica=4;
  279. cat <<__EOF__ > /usr/local/bin/init_gluster4
  280. server=\$1  
  281. host01=\$2  
  282. host02=\$3  
  283. host03=\$4
  284. host04=\$5  
  285. volume=\$6
  286. replica=\$7
  287. gluster peer status
  288. #execute on one server
  289. #glusterfs dwa volumeny vol0 (iso) I vol1 (gfs) na sda3 i sda2  
  290. #gluster volume stop \$volume force
  291. #gluster volume delete \$volume force
  292. gluster volume create \$volume replica \$replica \${server}\${host01}:/export/\${server}\${host01}-\$volume \${server}\${host02}:/export/\${server}\${host02}-\$volume \${server}\${host03}:/export/\${server}\${host03}-\$volume \${server}\${host04}:/export/\${server}\${host04}-\$volume force  
  293. gluster volume set \$volume nfs.port 2049  
  294. gluster volume set \$volume performance.cache-size 256MB  
  295. gluster volume set \$volume performance.write-behind-window-size 256MB  
  296. gluster volume set \$volume performance.io-thread-count 64  
  297. gluster volume set \$volume performance.io-cache on  
  298. gluster volume set \$volume performance.read-ahead on  
  299. gluster volume set \$volume performance.flush-behind on
  300. gluster volume set \$volume diagnostics.brick-log-level NONE
  301. gluster volume set \$volume diagnostics.client-log-level NONE
  302. gluster volume set \$volume cluster.data-self-heal-algorithm diff
  303. gluster volume set \$volume cluster.stripe-block-size 524288
  304. gluster volume set \$volume cluster.eager-lock enable
  305. #gluster volume set \$volume nfs.disable on
  306. gluster volume start \$volume  
  307. gluster volume info \$volume  
  308. gluster volume status \$volume  
  309. #montowanie NFS SR pod localhost lub VIP :/vol0 lub vol1  
  310. __EOF__
  311. chmod 755 /usr/local/bin/init_gluster4
  312.  
  313. #init_gluster3 "xen" "1" "2" "3" "vol2" 3
  314. #init_gluster3 "xenserverhw" "06" "08" "03" "04" "vol2" 3
  315. #server="xenserverhw"; host01="06"; host02="08"; host03="03"; host04="04"; volume="vol0"; replica=4;
  316. cat <<__EOF__ > /usr/local/bin/init_gluster3
  317. server=\$1  
  318. host01=\$2  
  319. host02=\$3  
  320. host03=\$4
  321. volume=\$6
  322. replica=\$7
  323. gluster peer status
  324. #execute on one server
  325. #glusterfs dwa volumeny vol0 (iso) I vol1 (gfs) na sda3 i sda2  
  326. #gluster volume stop \$volume force
  327. #gluster volume delete \$volume force
  328. gluster volume create \$volume replica \$replica \${server}\${host01}:/export/\${server}\${host01}-\$volume \${server}\${host02}:/export/\${server}\${host02}-\$volume \${server}\${host03}:/export/\${server}\${host03}-\$volume force  
  329. gluster volume set \$volume nfs.port 2049  
  330. gluster volume set \$volume performance.cache-size 256MB  
  331. gluster volume set \$volume performance.write-behind-window-size 256MB  
  332. gluster volume set \$volume performance.io-thread-count 64  
  333. gluster volume set \$volume performance.io-cache on  
  334. gluster volume set \$volume performance.read-ahead on  
  335. gluster volume set \$volume performance.flush-behind on
  336. gluster volume set \$volume diagnostics.brick-log-level NONE
  337. gluster volume set \$volume diagnostics.client-log-level NONE
  338. gluster volume set \$volume cluster.data-self-heal-algorithm diff
  339. gluster volume set \$volume cluster.stripe-block-size 524288
  340. gluster volume set \$volume cluster.eager-lock enable
  341. #gluster volume set \$volume nfs.disable on
  342. gluster volume start \$volume  
  343. gluster volume info \$volume  
  344. gluster volume status \$volume  
  345. #montowanie NFS SR pod localhost lub VIP :/vol0 lub vol1  
  346. __EOF__
  347. chmod 755 /usr/local/bin/init_gluster3
  348.  
  349. #init_gluster2 "xen" "1" "2" "vol0" 2
  350. #server="xen"; host01="1"; host02="2"; volume="vol0"; replica=2;
  351. cat <<__EOF__ > /usr/local/bin/init_gluster2
  352. server=\$1  
  353. host01=\$2  
  354. host02=\$3  
  355. volume=\$4
  356. replica=\$5
  357. gluster peer status
  358. #execute on one server
  359. #glusterfs dwa volumeny vol0 (iso) I vol1 (gfs) na sda3 i sda2  
  360. #gluster volume stop \$volume force
  361. #gluster volume delete \$volume force
  362. gluster volume create \$volume replica \$replica \${server}\${host01}:/export/\${server}\${host01}-\$volume \${server}\${host02}:/export/\${server}\${host02}-\$volume force  
  363. gluster volume set \$volume nfs.port 2049  
  364. gluster volume set \$volume performance.cache-size 256MB  
  365. gluster volume set \$volume performance.write-behind-window-size 256MB  
  366. gluster volume set \$volume performance.io-thread-count 64  
  367. gluster volume set \$volume performance.io-cache on  
  368. gluster volume set \$volume performance.read-ahead on  
  369. gluster volume set \$volume performance.flush-behind on
  370. gluster volume set \$volume diagnostics.brick-log-level NONE
  371. gluster volume set \$volume diagnostics.client-log-level NONE
  372. gluster volume set \$volume cluster.data-self-heal-algorithm diff
  373. gluster volume set \$volume cluster.stripe-block-size 524288
  374. gluster volume set \$volume cluster.eager-lock enable
  375. #gluster volume set \$volume nfs.disable on
  376. gluster volume start \$volume  
  377. gluster volume info \$volume  
  378. gluster volume status \$volume  
  379. #montowanie NFS SR pod localhost lub VIP :/vol0 lub vol1  
  380. __EOF__
  381. chmod 755 /usr/local/bin/init_gluster2
  382.  
  383. #init_brick "/dev/sdb1" "vol2"
  384. cat <<__EOF__ > /usr/local/bin/init_brick
  385. dev4gfs=\$1  
  386. volume=\$2  
  387. hname=\`hostname\`
  388. mkfs.ext4 -m 0 -j \$dev4gfs
  389. tune2fs -O dir_index -o user_xattr \$dev4gfs
  390. mkdir -p /export/\${hname}-\${volume}
  391. echo  "\$dev4gfs /export/\${hname}-\${volume} ext4 rw,noatime,nodiratime,user_xattr,barrier=0,data=ordered 1 2" >> /etc/fstab
  392. mount -a
  393. __EOF__
  394. chmod 755 /usr/local/bin/init_brick
  395.  
  396. #reformat_brick "/dev/sda2" "vol1"
  397. cat <<__EOF__ > /usr/local/bin/reformat_brick
  398. dev4gfs=\$1  
  399. volume=\$2  
  400. hname=\`hostname\`
  401. umount /export/\${hname}-\${volume}
  402. mkfs.ext4 -m 0 -j \$dev4gfs
  403. tune2fs -O dir_index -o user_xattr \$dev4gfs
  404. mount /export/\${hname}-\${volume}
  405. __EOF__
  406. chmod 755 /usr/local/bin/reformat_brick
  407.  
  408. #removeallandformat "/dev/sdb"
  409. cat <<__EOF__ > /usr/local/bin/removeallandformat
  410. #!/bin/bash
  411. # Script to automatically format all partitions on /dev/sda and create
  412. # a single partition for the whole disk
  413. # Remove each partition
  414. for v_partition in \`parted -s \$1 print|awk '/^ / {print \$1}'\`; do umount \$1\${v_partition}; parted -s \$1 rm \${v_partition}; done
  415. # Find size of disk
  416. v_disk=\`parted -s \$1 print|awk '/^Disk \/dev/ {print \$3}'| sed 's/[Mm][Bb]//'\`
  417. # Create single partition
  418. parted -s \$1 mkpart primary 1 \${v_disk}
  419. # Format the partition
  420. # mke2fs -T ext3 \${1}1
  421. __EOF__
  422. chmod 755  /usr/local/bin/removeallandformat
  423.  
  424. #KONIEC
Add Comment
Please, Sign In to add comment