trove image
2016-11-24
版本信息
image系统:centos7
mysql官方版本,mysql-community, 5.5和5.6
镜像制作
基本环境
与基本的镜像一样,cloud-init等。
另外为了调试方便,可以将公钥提前放到镜像中,若出现问题可以登陆实例查询问题。
Trove相关
- 在实例中需要运行trove-guestagent服务, 则需要在镜像中配置与stack环境一致的rdo源,安装openstack-trove-guestagent, 具体有:trove 启动instance时会将
1
yum -y install openstack-trove-guestagent python-troveclient python-netifaces pexpect python-oslo-serialization
guest_info
、trove-guestagent.conf
注入到实例,而注入的path是/etc/
下,需要与trove-guesagent的systemd服务文件对应,添加软链接或者修改服务文件。将1
ln -s /etc/trove-guestagent.conf /etc/trove/trove-guestagent.conf
openstack-trove-guestagent.service
设置开机启动:1
systemctl enable openstack-trove-guestagent.service systemctl start openstack-trove-guestagent.service
Mysql 相关
- 安装官方的mysql,配置源和选择版本:
1
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm rpm -ivh mysql-community-release-el7-5.noarch.rpm
编辑/etc/yum.repos.d/mysql-community.repo
选择相应版本的mysql源,安装:1
yum -y install mysql-server
进行相应配置:
1 | mkdir -p /etc/mysql chown mysql:mysql -R /etc/mysql mkdir -p /etc/my.cnf.d/conf.d ln -s /etc/my.cnf.d/conf.d /etc/mysql ln -s /etc/my.cnf /etc/mysql/my.cnf if [ ! -d /var/run/mysqld ]; then mkdir -p /var/run/mysqld chown mysql. /var/run/mysqld fi |
- 安装备份工具
percona-xtrabackup
1
yum -y install http://www.percona.com/downloads/percona-release/redhat/0.1-3/percona-release-0.1-3.noarch.rpm echo exclude=Percona-SQL Percona-Server Percona-XtraDB-Cluster* >> /etc/yum.conf yum -y install percona-xtrabackup
制作工具
一个自动构建工具:
https://github.com/denismakogon/trove-guest-image-elements
进行部分的修改来适合juno版本mysql镜像制作:
https://github.com/ly798/trove-guest-image-elements/tree/juno-mysql
1 | ./create_trove_image.sh -d centos -s mysql -i CentOS-7-x86_64-GenericCloud.qcow2 |