您好,登錄后才能下訂單哦!
本文檔是手動制作mysql5.5的trove鏡像
openstack版本為newton
1、創建基礎虛擬機
登錄openstack創建一臺虛擬機,這臺虛擬機用于制作trove鏡像,虛擬機的根磁盤最終會上傳到glance給trove使用,虛擬機的根磁盤容量根據需要設置,這里略掉這步的詳細操作。
以下操作皆登錄到這臺虛擬機中操作
2、 配置ssh
cat /etc/ssh/sshd_config UseDNS no
3、添加mysql源
yum install http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm yum remove mariadb-libs
4、編輯/etc/yum.repos.d/mysql-community.repo 禁用mysql5.7,啟用mysql5.5
# Enable to use MySQL 5.5 [mysql55-community] name=MySQL 5.5 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/ enabled=0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
5、安裝mysql5.5
安裝完mysql後,不必設置mysqld隨機啟動
yum install mysql-community-server
6、配置mysql
6.1、編輯/etc/my.cnf,在文件末尾添加下面一行,include這行上面有一行空白
... !includedir /etc/mysql/conf.d/
6.2 創建目錄
mkdir -p /etc/mysql/conf.d/
7、安裝percona-xtrabackup
innobackupex yum install https://www.percona.com/redir/downloads/percona-release/redhat/percona-release-0.1-4.noarch.rpm yum install percona-xtrabackup-24
8、源代碼安裝trove-agent
8.1、安裝相關軟件包
yum install git python-virtualenv
8.2、創建用戶
useradd -m trove # 設置trove sudo cat /etc/sudoers.d/trove Defaults:trove !requiretty trove ALL=(ALL) NOPASSWD:ALL
8.3、下載trove源碼
mkdir /opt/trove chown trove:trove /opt/trove su - trove cd /opt/trove git clone https://github.com/openstack/trove.git
8.4、整合代碼
由于在centos上備份時,有bug:1649592,已經整合到master分支,需要將commit整合進stable/newton分支
commit c1fd3e3a4c643dba524656c8d53d3506233beaf3 Merge: 880c707 f5d1cae Author: Jenkins <jenkins@review.openstack.org> Date: Thu Jan 19 16:07:48 2017 +0000 Merge "Fix backup of mysql variants on Centos" ... commit f5d1caea889f85196dfc1efe4892560f0b145191 Author: Doug Shelley <doug@parelastic.com> 2016-01-20 04:22:03 Committer: Doug Shelley <doug@parelastic.com> 2016-12-14 00:29:41
8.5、整合提交
git config --global user.email "youre mail" git config --global user.name "yuoure name" git checkout stable/newton git cherry-pick f5d1cae
8.6、安裝trove
8.6.1、安裝trove
yum install gcc su - trove cd /opt/trove virtualenv ven source ven/bin/activate pip install pip --upgrade cd trove pip install -r requirements.txt \ --index-url http://mirrors.aliyun.com/pypi/simple/ \ --trusted-host mirrors.aliyun.com python setup.py install
8.6.2、創建相關目錄及啟動文件
mkdir -p /etc/trove/conf.d chown -R trove:trove /etc/trove mkdir -p /var/lib/trove chown -R trove:trove /var/lib/trove mkdir -p /var/log/trove chown -R trove:trove /var/log/trove # 如果trove-guestagent.conf,guest_info.conf未預先創建, # 并設置/etc/trove的owner為trove,創建instance后, # 由nova注入的這兩個文件將擁有root權限 # 文件預先存在,nova 注入文件不改變文件的user和group,會改變文件的讀寫權限 touch /etc/trove/conf.d/trove-guestagent.conf touch /etc/trove/conf.d/guest_info.conf chown -R trove:trove /etc/trove cat /usr/lib/systemd/system/trove-guestagent.service [Unit] Description=OpenStack Trove guestagent Service After=syslog.target network.target [Service] Type=simple User=trove ExecStart=/opt/trove/ven/bin/trove-guestagent --config-file /etc/trove/conf.d/trove-guestagent.conf --config-file /etc/trove/conf.d/guest_info.conf Restart=on-failure [Install] WantedBy=multi-user.target systemctl daemon-reload # 這一步不是必須的 systemctl enable trove-guestagent
9、上傳鏡像
9.1、清理系統
rm -rf .ssh rm -rf /home/trove/.cache/ rm -rf /var/lib/mysql/auto.cnf poweroff
9.2、將鏡像制作成快照
10、配置trove使用制作好的鏡像
trove-manage --config-file /etc/trove/trove.conf \ datastore_version_update mysql mysql-5.5 mysql \ 0eb99bad-ad41-420c-bab5-844d84421c23 '' 1
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。