redis 3.2 鏡像製作及驗證 鏡像製作 1.安裝redis yum install redis yum install epl release yum install python pip git gcc pip2 install redis pip2 install hiredis vim ...
redis-3.2 鏡像製作及驗證
鏡像製作
1.安裝redis
yum install redis
yum install epl-release
yum install python-pip git gcc
pip2 install redis
pip2 install hiredis
vim /etc/redis.conf
protected-mode no
systemctl enable redis
2.源碼安裝trove-guestagent
useradd -m trove
Defaults:trove !requiretty
trove ALL=(ALL) NOPASSWD:ALL
cd /root/
git clone https://github.com/openstack/trove.git -b stable/pike
cd trove
pip install -r requirements.txt \
--index-url http://mirrors.aliyun.com/pypi/simple/ \
--trusted-host mirrors.aliyun.com
python setpu.py install
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
touch /etc/trove/conf.d/trove-guestagent.conf
touch /etc/trove/conf.d/guest_info.conf
chown -R trove:trove /etc/trove
vim /etc/trove/conf.d/trove-guestagent.conf
[DEFAULT]
debug = True
log_dir = /var/log/trove
log_file = trove-guestagent.log
transport_url = rabbit://openstack:[email protected]:5672,openstack:[email protected]:5672,openstack:[email protected]:5672
nova_proxy_admin_user = admin
nova_proxy_admin_pass = hnB2MqIjMjsJlRsttcI6Z9d7V12ZsekUyywntz4g
nova_proxy_admin_tenant_name = service
trove_auth_url = http://192.168.10.200:5000/v3
taskmanager_manager = trove.taskmanager.manager.Manager
datastore_manager = redis
max_accepted_volume_size = 4096
volume_fstype = ext4
[oslo_messaging_notifications]
driver = messagingv2
topics = 'notifications'
transport_url = rabbit://openstack:[email protected]:5672,openstack:[email protected]:5672,openstack:[email protected]:5672
[oslo_massaging_rabbit]
transport_url = rabbit://openstack:[email protected]:5672,openstack:[email protected]:5672,openstack:[email protected]:5672
[redis]
backup_strategy = RedisBackup
backup_namespace = trove.guestagent.strategies.backup.experimental.redis_impl
restore_namespace = trove.guestagent.strategies.restore.experimental.redis_impl
vim /usr/lib/systemd/system/trove-guestagent.service
[Unit]
Description=OpenStack Trove guestagent Service
After=syslog.target network.target
[Service]
Type=simple
User=trove
ExecStart=/usr/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.service
備註:kolla-ctrl1,kolla-ctrl2,kolla-ctrl3 trove.conf所有配置文件都要修改
vim /etc/kolla/trove-api/trove.conf
vim /etc/kolla/trove-taskmanager/trove-taskmanager.conf
添加如下配置文件
[redis]
tcp_port = 6379,16379
volume_support = False
docker restart trove_api trove_conductor trove_taskmanager
驗證
trove-manage --config-file /etc/trove/trove.conf datastore_update redis ''
trove-manage --config-file /etc/trove/trove.conf \
datastore_version_update \
redis redis-3.2 redis 659d9d8a-94fb-438b-8cae-7b3f34a9ddd8 ''
trove create redis-3 cf4a9a2f-5c61-4dfa-97a5-e89811daf773 --datastore redis --datastore_version redis-3.2 --nic net-id=ab9c9463-ea02-4b60-b559-1857e5ebfc13
trove backup-create redis-3 redis-3_001_bak
trove create redis-3-restore cf4a9a2f-5c61-4dfa-97a5-e89811daf773 --datastore redis --datastore_version redis-3.2 --nic net-id=ab9c9463-ea02-4b60-b559-1857e5ebfc13 --backup backupID
trove create redis3-slave cf4a9a2f-5c61-4dfa-97a5-e89811daf773 --datastore redis --datastore_version redis-3.2 --nic net-id=ab9c9463-ea02-4b60-b559-1857e5ebfc13 --replica_of redis-3 --replica_count 1
trove show redis3-salve
進入master 實例:
redis-ctl:
> set hello world
> get hello
world
> set zhangsan nihao
> get zhangsan
nihao
進入slave實例:
redis-ctl:
> get hello
world
> get zhangsan
nihao