Linux运维---02.制作trove-redis镜像

2020-02-27 16:01:41来源:博客园 阅读 ()

新老客户大回馈,云服务器低至5折

Linux运维---02.制作trove-redis镜像

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:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.31:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.32:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.33: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:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.31:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.32:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.33:5672  
[oslo_massaging_rabbit]  
transport_url = rabbit://openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.31:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.32:5672,openstack:SZZfvIijANfzblmRAwyuZmWISF0VtlkgMOhAi4fa@192.168.10.33: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   

原文链接:https://www.cnblogs.com/shiyw/p/12372554.html
如有疑问请与原作者联系

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:Linux运维-磁盘存储---3.LVM

下一篇:linux中其他搜索命令(locate/which/whereis/grep)