DBRD 8.4.6 source Code compilation installation

Source: Internet
Author: User
Tags locale

----------------------------0. System Environment----------------------------DB01 192.168.50.10/DEV/SDB1 primary node db02 192.168.50.20/d  EV/SDB1 node # grep-v "#"/etc/hosts192.168.50.10 db01 db01.mysql.com192.168.50.20 db02 db02.mysql.com# A new hard drive ll/dev/sd*ll /DEV/SDB*BRW-RW----1 root disk 8, June 13:37/DEV/SDBBRW-RW----1 root disk 8, June 13:37/DEV/SDB1NOTE:SDB1 partition Unformatted.----------------------------1. Preparing the installation Environment----------------------------Yum install-y make Automak kernel kernel-devel Kernel-headers GCC Flex libxslt----------------------------2. Compile and install DRBD----------------------------wget http:// Oss.linbit.com/drbd/8.4/drbd-8.4.6.tar.gztar xzf drbd-8.4.6.tar.gzcd drbd-8.4.6------------------#开始编译安装drbd, Unlike 8.4.5 versions, this is not available here./configure, just make it./configure--PREFIX=/USR/LOCAL/DRBD--with-km--with-heartbeat-- sysconfdir=/etc/#with-km Open kernel module #with-heartbeat open Heart Support #ls-ld/usr/src/kernels/$ (uname-r)/make KDIR=/usr/src/ kernels/$ (uname-r)/#指定内核源路径开始编译 #make install--Direct result: Make-c DRBD installmake[1]: Entering directory '/SOFT/DRBD-8.4.6/DRBD ' install-d//lib/modules/2.6.32-431.el6.x86_64/updatesinstall-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 | | TRUEMAKE[1]: Leaving Directory '/SOFT/DRBD-8.4.6/DRBD ' compilation successful module installation Location #modprobe-l | Grep-i Drbdupdates/drbd.ko Loading Module # modprobe Drbd#lsmod | grep drbddrbd 376868 0 libcrc32c 1246 1 DRBD----------------------------3. Compile and install 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 here with the--without-83support, because the installation is more than 8.4 version #./configure--PREFIX=/USR/LOCAL/DRBD--sysconfdir=dir--without-83support/****************** Parameters detailed fine tuning of the Installation directories:--bindir=dir user executables [Eprefix/bin]--sbindir=dir System admin EX    Ecutables [Eprefix/sbin]--libexecdir=dir    program executables [eprefix/libexec]--sysconfdir=dir read-only single-machine data [prefix/etc]--sharedsta  Tedir=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.-inde pendent 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/D RBD]--htmldir=dir HTML documentation [DOCDIR]--dvidir=dir DVI documentation [DOCDIR]--pdfdir=di R PDF Documentation [Docdir]--psdir=dir PS documentation [docdir]optional Features:--disable-option-checking Ignore UN Recognized--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 onlyoptional Packages:--with-package[=arg] Use package [Arg=yes]--without-package D  o not use package (same as--with-package=no)--without-83support does 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 Integ Ration--with-xen enable Xen integration--with-pacemaker enable pacemaker integration--with-heart Beat enable Heartbeat v1 haresources integration Scripts--with-rgmanager Enable Red Hat Cluster Suite inte Gration--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 the Override directory for init scripts (the 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)--wi  Th-systemdunitdir=dir Directory for systemd service files [Auto]--with-tmpfilesdir=dir Install                          Configuration files for management of the volatile files and directories in DIR [[PREFIX/LIB/TMPFILES.D]]--with-initscripttype=init_script_type TYPE of INIT SCRIPT to INS                Tall (sysv|systemd|both).          [auto]********************************/#make #make Install after installation the DRBD related tool (Drbdadm,drbdsetup) is installed to/usr/local/drbd-u Tils-8.9.3/etc/sbin directory under #cp/usr/local/drbd/etc/rc.d/init.d/drbd/etc/rc.d/init.d/#chkconfig--add drbd#chkconfig-- Level 2345 DRBD on# links the commands of DRBD to the system command path ln-s/usr/local/drbd/sbin/*/usr/bin/----------------------------4. Setting the drbd.conf configuration File----------------------------This compilation installation configuration file location:/usr/local/drbd/etc/#vi/etc/ Drbd.conf----------------------------5. Start--------------------------------5.0 Configure R0 resources on both machines initialize R0 resources on two machines, respectively,  Before you create a DRBD partition to prepare for initialization, you need to create the corresponding metadata-saved data blocks on a blank partition on 2 hosts: Common before two blank partitions are completely purged of data, perform DD If=/dev/zero OF=/DEV/SDB1 on two hosts, respectively bs=1m count=128 drbdadm-c/etc/drbd.conf create-md All or drbdadm-c/etc/drbd.conf create-md r0--5.1 start two nodes drbdmkdir-p/usr/loc AL/DRBD/VAR/RUN/DRBD#/ETC/INIT.D/DRBD start starting DRBD resources:no Resources Defined!no Resources Defined!no Resour CES defined! PS: The hint does not define "resource" because the newly installed DRBD does not have a *.res configuration file #netstat |grep 7788--5.2 View status: #/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], 2015-06-24 13:47:15m:res CS ro ds p mounted FSTYPE0 : R0 Connected secondary/secondary inconsistent/inconsistent Ccs: Indicates the connection status ro: Indicates that the above representation is from DS: Hard disk status information above indicates that it is in real-time synchronization, incons Istent: Inconsistent # CAT/PROC/DRBD version:8.4.6 (api:1/proto:86-101) git-hash:833d830e0152d1e457fa7856e71e11248ccf3f70    build by [email protected], 2015-06-24 13:47:15 0:cs:connected ro:primary/secondary ds:uptodate/uptodate C r----- ns:40088 nr:0 dw:0 dr:40248 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0# drbd-overview 0:r0/0 Connected Secondary/Seco Ndary inconsistent/inconsistent--5.3 View version #cat/proc/drbd--5.4 View location Whereis DRBD----------------------------6. Operation--------------------------------6.1 Set node Master node # 1th step: Set master-slave first execution #drbdadm----Overwrite-data-of-peer primary all# 2nd step: The following two commands are normally executed after the first execution #drbdadm Primary--force r0 #drbdadm Primary all# 3rd step: Set Current node Master node # CAT/PROC/DRBD version:8.4.6 (api:1/proto:86-101) git-hash:833d830e0 152d1e457fa7856e71e11248ccf3f70 build by [email protected], 2015-06-24 13:47:15 0:cs:connected ro:Primary/ Secondary ds:UpToDate/UpToDate C r----- ns:40088 nr:0 dw:0 dr:40248 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos:0#drbda DM primary--force R0 # CAT/PROC/DRBD version:8.4.6 (api:1/proto:86-101) Git-hash: 833d830e0152d1e457fa7856e71e11248ccf3f70 build by [email protected], 2015-06-24 13:47:15 0:cs:connected ro: Primary/Secondary ds:UpToDate/UpToDate C r----- ns:40088 nr:0 dw:0 dr:40248 al:0 bm:0 lo:0 pe:0 ua:0 ap:0 ep:1 wo:f oos : 0 Description: Ro status changed to Ro:primary/secondary;ds Status: Uptodate/uptodate (Inconsisten) that is "real time/Real time (Inconsistent)"-----6.2 disk Format (only Primary nodes are formatted) #drbd-overview 0:r0/0 Connected primary/secondary uptodate/uptodate After synchronization is complete, you can format the blank disk. #mkfs. ext4/dev/drbd0 MKE2FS 1.41.12 (17-may-2010) Filesystem label=os type:linuxblock size=1024 (log=0) Fragment size=1024(log=0) Stride=0 blocks, Stripe width=0 blocks10040 inodes, 40088 blocks2004 blocks (5.00%) reserved for the Super Userfirst data Block=1maximum filesystem blocks=411566085 Block groups8192 blocks per group, 8192 fragments per group2008 inodes per Grou Psuperblock backups stored on blocks:8193, 24577Writing inode tables:done Creating Journal (4 096 blocks): donewriting superblocks and filesystem accounting information:donethis filesystem would be automatically chec  Ked every mounts or180 days, whichever comes first. Use Tune2fs-c or-i to override.----6.3 mount the DRBD partition to local (Mount only on primary node) # mkdir/drbd_data# mount/dev/drbd0/drbd_data/# CD/ drbd_data/#ls----6.4 Common Commands--6.4.1 view resource role (previously representing current resource role) # DRBDADM role R0 primary/secondary---6.4.2 view resource connection status #drbdadm cstate R0 Connected---6.4.3 view hard drive data status # DRBDADM dstate r0 uptodate/uptodate----6.4.4 Note 1. The two partition sizes of the primary and standby server synchronization are the best (no exact statement about whether the partition size must be the same) 2. It takes time to start synchronizing the disks of two nodes, and do not restart before synchronization is complete, otherwise it will be resynchronized. 3. Be sure to switch the current node to primary node 4 before mounting. Two nodes, at the same time there can only be one in thePrimary state and the other is in the secondary state. 5. The server in the Slave node (secondary) state cannot load the DRBD block device 6. Switch the primary node to the slave node before you uninstall 7. Before you switch a host to the primary node, make sure that another host is switched to the slave node. ----------------------------7. Test the DRBD Data image--------------------------------7.1 format mounted disk #mkfs.ext4/dev/drbd0# mkdir/ drbd_data# mount/dev/drbd0/drbd_data/# cd/drbd_data/---7.2 Generate test data #touch/drbd_data/test.txt#dd If=/dev/zero OF=/DRBD _data/test.tmp bs=1m count=20# drbdadm dstate r0 uptodate/uptodate---7.3 change the state of the primary node DRBD from # drbdadm role R0 Primary/secon Dary#umount/drbd_data#drbdadm secondary all# drbdadm role r0 secondary/secondary---7.4 Mount from node #drbdadm role R0 Seconda RY/SECONDARY#DRBDADM primary all#drbdadm role R0 primary/secondary#mkdir/drbd_data#mount/dev/drbd0/drbd_data/# Ls-ls /drbd_data/total 20493 drwx------2 root root 12288 June 17:02 lost+found20481-rw-r--r--1 root root 20971520 J UN 17:20 test.tmp tested successfully.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

DBRD 8.4.6 source Code compilation installation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.