dbrd 8.4.6 源代碼編譯安裝
---------------------------- 0.系統環境 ---------------------------- db01 192.168.50.10 /dev/sdb1 主節點 db02 192.168.50.20 /dev/sdb1 備節點 # grep -v "#" /etc/hosts 192.168.50.10 db01 db01.mysql.com 192.168.50.20 db02 db02.mysql.com #一塊新硬盤 ll /dev/sd* ll /dev/sdb* brw-rw---- 1 root disk 8, 16 Jun 24 13:37 /dev/sdb brw-rw---- 1 root disk 8, 17 Jun 24 13:37 /dev/sdb1 NOTE:sdb1分區未格式化. ---------------------------- 1.準備安裝環境 ---------------------------- yum install -y make automak kernel kernel-devel kernel-headers gcc flex libxslt ---------------------------- 2.編譯安裝drbd ---------------------------- wget http://oss.linbit.com/drbd/8.4/drbd-8.4.6.tar.gz tar xzf drbd-8.4.6.tar.gz cd drbd-8.4.6 ------------------#開始編譯安裝drbd,和8.4.5之前版本號有所不同,這裏不用./configure,直接make就能夠了 ./configure --prefix=/usr/local/drbd --with-km --with-heartbeat --sysconfdir=/etc/ #with-km開啟內核模塊 #with-heartbeat 開啟heart支持 #ls -ld /usr/src/kernels/$(uname -r)/ make KDIR=/usr/src/kernels/$(uname -r)/ #指定內核源路徑開始編譯 #make install --直接結果: make -C drbd install make[1]: Entering directory `/soft/drbd-8.4.6/drbd' install -d //lib/modules/2.6.32-431.el6.x86_64/updates install -m 644 drbd.ko //lib/modules/2.6.32-431.el6.x86_64/updates /sbin/depmod -a || /sbin/depmod -e drbd.ko 2>&1 >/dev/null || true make[1]: Leaving directory `/soft/drbd-8.4.6/drbd' 編譯成功模塊安裝位置 #modprobe -l | grep -i drbd updates/drbd.ko 載入模塊 # modprobe drbd #lsmod | grep drbd drbd 376868 0 libcrc32c 1246 1 drbd ---------------------------- 3.編譯安裝drbd-utils ---------------------------- #wget http://oss.linbit.com/drbd/drbd-utils-8.9.3.tar.gz-P /usr/local/src/ # tar -xf drbd-utils-8.9.3.tar.gz -C /usr/local/src # cd /usr/local/src/drbd-utils-8.9.3 這裏用了--without-83support,由於安裝的是8.4以上版本號 #./configure --prefix=/usr/local/drbd --sysconfdir=DIR --without-83support /******************參數具體解釋 Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/drbd] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-spec Rather than creating Makefiles, create an RPM spec file only Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-83support Do not include support for drbd driver/module <= 8.3 --without-84support Do not include support for drbd driver/module 8.4 --with-udev Enable udev integration --with-xen Enable Xen integration --with-pacemaker Enable Pacemaker integration --with-heartbeat Enable Heartbeat v1 haresources integration scripts --with-rgmanager Enable Red Hat Cluster Suite integration --with-bashcompletion Enable programmable bash completion --with-distro Configure for a specific distribution (supported values: generic, redhat, suse, debian, gentoo, slackware; default is to autodetect) --with-initdir Override directory for init scripts (default is distribution-specific) --with-noarchsubpkg Build subpackages that support it for the "noarch" architecture (makes sense only with --enable-spec, supported by RPM from 4.6.0 forward) --with-systemdunitdir=DIR Directory for systemd service files [Auto] --with-tmpfilesdir=DIR install configuration files for management of volatile files and directories in DIR [[PREFIX/lib/tmpfiles.d]] --with-initscripttype=INIT_SCRIPT_TYPE Type of init script to install (sysv|systemd|both). [auto] ********************************/ #make #make install 成功安裝後drbd相關的工具(drbdadm,drbdsetup)被安裝到/usr/local/drbd-utils-8.9.3/etc/sbin文件夾下 #cp /usr/local/drbd/etc/rc.d/init.d/drbd /etc/rc.d/init.d/ #chkconfig --add drbd #chkconfig --level 2345 drbd on #鏈接drbd的命令到系統命令路徑 ln -s /usr/local/drbd/sbin/* /usr/bin/ ---------------------------- 4.設置drbd.conf配置文件 ---------------------------- 本次編譯安裝配置文件位置:/usr/local/drbd/etc/ #vi /etc/drbd.conf ---------------------------- 5.啟動 ---------------------------- ----5.0 在兩臺機器上配置r0資源 兩臺機器上分別初始化r0資源,創建DRBD分區 準備初始化之前。須要分別在2個主機上的 空白分區上創建對應的元數據保存的數據塊: 常見之前現將兩塊空白分區徹底清除數據,分別在兩個主機上運行 dd if=/dev/zero of=/dev/sdb1 bs=1M count=128 drbdadm -c /etc/drbd.conf create-md all 或 drbdadm -c /etc/drbd.conf create-md r0 --5.1啟動兩個節點drbd mkdir -p /usr/local/drbd/var/run/drbd #/etc/init.d/drbd start Starting DRBD resources: no resources defined! no resources defined! no resources defined! PS:提示未定義“資源”。這是由於剛安裝好的DRBD,默認沒有*.res配置文件 #netstat |grep 7788 --5.2 查看狀態: #/etc/init.d/drbd status drbd driver loaded OK; device status: version: 8.4.6 (api:1/proto:86-101) GIT-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected]