back_log=1024
serverid在自动化安装脚本中自动生成。
将上面的data.tar 、my.cnf、生成的rpm包copy到ftp的pub目录下
/var/ftp/pub/
自动化安装脚本
auto_install_mysql.sh:
#!/bin/sh
yum install -y cmake gcc g++ bisonncurses-devel zlib
?
ftp -n<
user anonymous dexter
binary
cd pub
prompt
mget *
EOF
?
rpm -ivh mysql-rpm-5.6.21-renfengjun.x86_64.rpm
tar -xvf data.tar -C /u01/mysql/data/
chown -R mysql:mysql /u01/mysql/
?
unique_id=`date "+%Y%m%d%M%S"`
echo 'server_id='$unique_id >> my.cnf
?
cp my.cnf /u01/mysql/
执行远程自动安装命令
执行远程拷贝(dcli命令是我从一体机里面拿出来的脚本,py编写,其实和scp差不多,有需要的可以发邮箱)
如果批量的安装,需要先使用-k选项初始化一下ssh。
将脚本copy到远程
[root@centos511 ~]# ./dcli -l root -c192.168.0.36 -f ./auto_install_mysql.sh
执行远程命令,也可以放在后台
[root@centos511 ~]#./dcli -l root -c192.168.0.36 /root/ auto_install_mysql.sh
输出:
[[root@centos511 ~]# ./dcli -l root -c192.168.0.36 /root/get_rpm.sh
root@192.168.0.36's password:
192.168.0.36: Address 192.168.0.36 maps tolocalhost, but this does not map back to the address - POSSIBLE BREAK-INATTEMPT!
192.168.0.36: Loaded plugins: fastestmirror,security
192.168.0.36: Loading mirror speeds from cachedhostfile
192.168.0.36: * base: mirrors.btte.net
192.168.0.36: * extras: mirrors.btte.net
192.168.0.36: * updates: mirrors.yun-idc.com
192.168.0.36: Setting up Install Process
192.168.0.36: Packagecmake-2.6.4-5.el5.4.x86_64 already installed and latest version
192.168.0.36: Package gcc-4.1.2-55.el5.x86_64already installed and latest version
192.168.0.36: No package g++ available.
192.168.0.36: Package bison-2.3-2.1.x86_64already installed and latest version
192.168.0.36: Packagencurses-devel-5.5-24.20060715.x86_64 already installed and latest version
192.168.0.36: Packagencurses-devel-5.5-24.20060715.i386 already installed and latest version
192.168.0.36: Package zlib-1.2.3-7.el5.x86_64already installed and latest version
192.168.0.36: Package zlib-1.2.3-7.el5.i386already installed and latest version
192.168.0.36: Nothing to do
192.168.0.36: Please login with USER and PASS.
192.168.0.36: Please login with USER and PASS.
192.168.0.36: KERBEROS_V4 rejected as anauthentication type
192.168.0.36: Interactive mode off.
192.168.0.36: Preparing...? ? ? ? ? ? ? ##################################################
192.168.0.36: mysql-rpm? ? ? ? ? ? ? ? ? ##################################################
.......
结束。
验证一下
比较粗糙,还有需要改进的地方。慢慢完善吧。
--------------------------------------分割线 --------------------------------------
--------------------------------------分割线 --------------------------------------