代码改变世界

OpenStack Controller HA (3)

2014-06-02 18:59  陈尚华  阅读(464)  评论(0编辑  收藏  举报

3.5.安装配置dashboard

(1).yum安装dashboard

[root@controller01 ~]# yum -y install openstack-dashboard

(2).修改dashboard配置文件

[root@controller01 ~]# cp -av /etc/openstack-dashboard/local_settings /etc/openstack-dashboard/local_settings_bak

[root@controller01 ~]# vi /etc/openstack-dashboard/local_settings

#------------------------------------------------------------------------------------------------------------

DEBUG = False

------->

DEBUG = True

#------------------------------------------------------------------------------------------------------------

ALLOWED_HOSTS = ['horizon.example.com', 'localhost']

------->

ALLOWED_HOSTS = ['horizon.example.com', 'localhost', '*']

#------------------------------------------------------------------------------------------------------------

OPENSTACK_HOST = "127.0.0.1"

------->

OPENSTACK_HOST = "192.168.20.20"

#------------------------------------------------------------------------------------------------------------

SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))

------->

#SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))

SECRET_KEY = 'y3kT2DLiL1/n7cH/NbmfxA='

SESSION_ENGINE = 'django.contrib.sessions.backends.cache'


CACHES = {

    'default': {

        'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',

        'LOCATION' : ['192.168.20.21:11211','192.168.20.22:11211'],

    },

}

#------------------------------------------------------------------------------------------------------------

CACHES = {

    'default': {

        'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache'

    }

}

------->

#CACHES = {

#    'default': {

#        'BACKEND' : 'django.core.cache.backends.locmem.LocMemCache'

#    }

#}

#------------------------------------------------------------------------------------------------------------

(3).修改httpd配置文件

[root@controller01 ~]# cp -av /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_bak

[root@controller01 ~]# vi /etc/httpd/conf/httpd.conf

#Listen 12.34.56.78:80

Listen 192.168.20.21:80

#ServerName www.example.com:80

ServerName 192.168.20.21:80

[root@controller02 ~]# vi /etc/httpd/conf/httpd.conf

#Listen 12.34.56.78:80

Listen 192.168.20.22:80

#ServerName www.example.com:80

ServerName 192.168.20.22:80

(4).启动dashboard

[root@controller01 ~]# service httpd start

[root@controller01 ~]# chkconfig httpd on

[root@controller01 ~]# service memcached start

[root@controller01 ~]# chkconfig memcached on

(5).设置Iptables:

[root@controller01 ~]# iptables -I INPUT -p tcp --dport 80 -j ACCEPT

[root@controller01 ~]# iptables -I INPUT -p tcp -m multiport --dports 5900:6000 -j ACCEPT

[root@controller01 ~]# iptables -I INPUT -p tcp --dport 6080 -j ACCEPT

[root@controller01 ~]# service iptables save


3.6.安装配置cinder

(1).yum安装cinder

[root@controller01 ~]# yum -y install openstack-cinder openstack-selinux

(2).创建user、定义services和endpoint

[root@controller01 ~]# keystone user-create --name=cinder --pass=service --email=cinder@chensh.net

[root@controller01 ~]# keystone user-role-add --user=cinder --tenant=service --role=admin

[root@controller01 ~]# vi /root/config/cinder-user.sh

#!/bin/sh

my_ip=controller

keystone service-create --name=cinder --type=volume --description="Cinder Volume Service"

service=$(keystone service-list | awk '/volume/ {print $2}')

keystone endpoint-create --service-id=$service --publicurl=http://$my_ip:8776/v1/%\(tenant_id\)s --internalurl=http://$my_ip:8776/v1/%\(tenant_id\)s --adminurl=http://$my_ip:8776/v1/%\(tenant_id\)s

keystone service-create --name=cinder --type=volumev2 --description="Cinder Volume Service V2"

service=$(keystone service-list | awk '/volumev2/ {print $2}')

keystone endpoint-create --service-id=$service --publicurl=http://$my_ip:8776/v2/%\(tenant_id\)s --internalurl=http://$my_ip:8776/v2/%\(tenant_id\)s --adminurl=http://$my_ip:8776/v2/%\(tenant_id\)s

[root@controller01 ~]# sh /root/config/cinder-user.sh

(3).定义cinder配置文件

[root@controller01 ~]# cp -av /etc/cinder/cinder.conf /etc/cinder/cinder.conf_bak

[root@controller01 ~]# sed -i '/^#/d' /etc/cinder/cinder.conf

[root@controller01 ~]# sed -i '/^$/d' /etc/cinder/cinder.conf

[root@controller01 ~]# vi /etc/cinder/cinder.conf

[DEFAULT]

osapi_volume_listen = controller01

osapi_volume_listen_port = 8776

log_dir = /var/log/cinder

state_path = /var/lib/cinder

lock_path = /var/lib/cinder/tmp

#volumes_dir=/openstack/cinder/volumes

iscsi_helper = tgtadm

#connection = mysql://cinder:cinder@mysqlserver/cinder

volume_driver = cinder.volume.drivers.glusterfs.GlusterfsDriver

glusterfs_shares_config = /etc/cinder/shares.conf

glusterfs_mount_point_base = /openstack/cinder/volumes

notification_driver = cinder.openstack.common.notifier.rpc_notifier

control_exchange = cinder

rpc_backend = cinder.openstack.common.rpc.impl_qpid

qpid_hostname = controller01

auth_strategy = keystone

[BRCD_FABRIC_EXAMPLE]

[database]

connection = mysql://cinder:cinder@mysqlserver/cinder

[fc-zone-manager]

[keymgr]

[keystone_authtoken]

[matchmaker_ring]

[ssl]

[root@controller02 ~]# vi /etc/cinder/cinder.conf

[DEFAULT]

osapi_volume_listen = controller02

osapi_volume_listen_port = 8776

log_dir = /var/log/cinder

state_path = /var/lib/cinder

lock_path = /var/lib/cinder/tmp

#volumes_dir=/openstack/cinder/volumes

iscsi_helper = tgtadm

#connection = mysql://cinder:cinder@mysqlserver/cinder

volume_driver = cinder.volume.drivers.glusterfs.GlusterfsDriver

glusterfs_shares_config = /etc/cinder/shares.conf

glusterfs_mount_point_base = /openstack/cinder/volumes

notification_driver = cinder.openstack.common.notifier.rpc_notifier

control_exchange = cinder

rpc_backend = cinder.openstack.common.rpc.impl_qpid

qpid_hostname = controller02

auth_strategy = keystone

[BRCD_FABRIC_EXAMPLE]

[database]

connection = mysql://cinder:cinder@mysqlserver/cinder

[fc-zone-manager]

[keymgr]

[keystone_authtoken]

[matchmaker_ring]

[ssl]

[root@controller01 ~]# cp -av /etc/cinder/api-paste.ini /etc/cinder/api-paste.ini_bak

[root@controller01 ~]# vi /etc/cinder/api-paste.ini

auth_host = controller

auth_port = 35357

auth_protocol = http

admin_user = cinder

admin_tenant_name = service

admin_password = service

(4).修改cinder数据存储路径

[root@controller01 ~]# grep -q /openstack/cinder/volumes /etc/tgt/targets.conf || sed -i '1iinclude /openstack/cinder/volumes/*' /etc/tgt/targets.conf

(5).同步cinder数据库

[root@controller01 ~]# cinder-manage db sync

(6).启动cinder相关服务

[root@controller01 ~]# service tgtd start

[root@controller01 ~]# chkconfig tgtd on

[root@controller01 ~]# service openstack-cinder-api start

[root@controller01 ~]# service openstack-cinder-scheduler start

[root@controller01 ~]# service openstack-cinder-volume start

[root@controller01 ~]# chkconfig openstack-cinder-api on

[root@controller01 ~]# chkconfig openstack-cinder-scheduler on

[root@controller01 ~]# chkconfig openstack-cinder-volume on