MySQL+heartbeat+nfs做高可用
时间:2021-07-01 10:21:17
帮助过:11人阅读
node1:10.10.10.202node2:10.10.10.203nfs服务器:node3:10.10.10.204系统环境CentOS release 6.5 (Final)二、在nfs服务器上创建MySQL的共享目录mkdir /datavim /etc/exports/data 10.10.10.0/24(rw,no_root_squash)重新导出文件系统exportfs -rav在客户端查看一下并尝试挂载showmount -e 10.10.10.204mount -t nfs 10.10.10.204:/data /data添加MySQL的用户组以及用户(要保持每个节点的mysql用户和组的id是一致的哦)groupadd -r -g 250 mysqluseradd -u 250 -g mysql mysqlsetfacl -m u:mysql:rwx /datanode1:groupadd -r -g 250 mysqluseradd -u 250 -g mysql mysqlnode2:groupadd -r -g 250 mysqluseradd -u 250 -g mysql mysqlnode1和node2:tar xf mariadb-10.0.28-linux-glibc_214-x86_64.tar.gz -C /usr/local/ln -sv mariadb-10.0.28-linux-x86_64 mysqlchown root.mysql . -Rmkdir /data/{database,binlog}chown -R mysql.mysql /data初始化数据库mariaDB10.0.28需要安装2.14版本的glibc而6.5是2.12错误提示:./bin/my_print_defaults: /lib64/libc.so.6: version `GLIBC_2.14‘ not found (required by ./bin/my_print_defaults)解决办法:升级glibcwget http://ftp.gnu.org/gnu/glibc/glibc-2.14.tar.gztar zxvf glibc-2.14.tar.gzcd glibc-2.14mkdir buildcd build../configure --prefix=/usr/local/glibc-2.14makemake installexport LD_LIBRARY_PATH=/usr/local/glibc-2.14/lib:$LD_LIBRARY_PATHln -sf /usr/local/glibc-2.14/lib/libc-2.14.so /lib64/libc.so.6ln -sf /lib64/libc-2.14.so /lib64/libc.so.6错误提示:Installing MariaDB/MySQL system tables in ‘/data/database‘ ..../bin/mysqld: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15‘ not found (required by ./bin/mysqld)解决办法:升级gccwget http://ftp.gnu.org/gnu/gcc/gcc-4.8.0/gcc-4.8.0.tar.bz2tar -jxvf gcc-4.8.0.tar.bz2cd gcc-4.8.0./contrib/download_prerequisitescd ..mkdir gcc-build-4.8.0cd gcc-build-4.8.0../gcc-4.8.0/configure --enable-checking=release --enable-languages=c,c++ --disable-multilibmake错误提示:make[2]: *** [configure-stage1-libcpp] 错误 1make[2]: Leaving directory `/opt/gcc-build-4.8.0‘make[1]: *** [stage1-bubble] 错误 2make[1]: Leaving directory `/opt/gcc-build-4.8.0‘make: *** [all] 错误 2解决办法:yum install gcc-c++ make install确定新安装的GCC的路径,一般默认在/usr/local/bin下。ls /usr/local/bin | grep gcc查看gcc的版本可以用gcc -v添加新GCC到可选项,倒数第三个是名字,倒数第二个参数为新GCC路径,最后一个参数40为优先级,设大一些之后就自动使用新版了update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/i686-pc-linux-gnu-gcc 40先用strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX查看支持的版本ln -sf /usr/local/lib64/libstdc++.so.6.0.18 /usr/lib64/libstdc++.so.6复制MySQL的启动脚本和配置文件mkdir /etc/mysqlcp support-files/my-large.cnf /etc/mysql/my.cnfcp support-files/mysql.server /etc/rc.d/init.d/mysqldchmod +x /etc/rc.d/init.d/mysqldchkconfig --add mysqldchkconfig mysqld offvim /etc/mysql/my.cnf加入datadir = /data/databaseinnodb_file_per_table = ONlog-bin=/data/binlog/master-bin启动服务/etc/init.d/mysqld startMySQL+heartbeat+nfs做高可用
标签:string centos groupadd style disable load lang inno 支持