qq70191 发表于 2015-4-12 14:39:23

OpenStack Controller HA (3)

  3.5.安装配置dashboard
  (1).yum安装dashboard
  # yum -y install openstack-dashboard
  (2).修改dashboard配置文件
  # cp -av /etc/openstack-dashboard/local_settings /etc/openstack-dashboard/local_settings_bak
  # 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配置文件
  # cp -av /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_bak

  
  # 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
  
# 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
# service httpd start
# chkconfig httpd on

# service memcached start
# chkconfig memcached on
(5).设置Iptables:

  # iptables -I INPUT -p tcp --dport 80 -j ACCEPT
  # iptables -I INPUT -p tcp -m multiport --dports 5900:6000 -j ACCEPT
  # iptables -I INPUT -p tcp --dport 6080 -j ACCEPT
  # service iptables save



3.6.安装配置cinder
(1).yum安装cinder
# yum -y install openstack-cinder openstack-selinux

(2).创建user、定义services和endpoint
  
  # keystone user-create --name=cinder --pass=service --email=cinder@chensh.net
  # keystone user-role-add --user=cinder --tenant=service --role=admin
  # 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
  # sh /root/config/cinder-user.sh
  (3).定义cinder配置文件
  # cp -av /etc/cinder/cinder.conf /etc/cinder/cinder.conf_bak
  # sed -i '/^#/d' /etc/cinder/cinder.conf
  # sed -i '/^$/d' /etc/cinder/cinder.conf
  # vi /etc/cinder/cinder.conf
  
  
  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
  
  
  connection = mysql://cinder:cinder@mysqlserver/cinder
  
  
  
  
  
  
# vi /etc/cinder/cinder.conf


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


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





  
  # cp -av /etc/cinder/api-paste.ini /etc/cinder/api-paste.ini_bak
  # 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数据存储路径
  # grep -q /openstack/cinder/volumes /etc/tgt/targets.conf || sed -i '1iinclude /openstack/cinder/volumes/*' /etc/tgt/targets.conf
  
  (5).同步cinder数据库
  # cinder-manage db sync
  (6).启动cinder相关服务
  # service tgtd start
  # chkconfig tgtd on
  # service openstack-cinder-api start
  # service openstack-cinder-scheduler start
  # service openstack-cinder-volume start
  # chkconfig openstack-cinder-api on
  # chkconfig openstack-cinder-scheduler on
  # chkconfig openstack-cinder-volume on
  
页: [1]
查看完整版本: OpenStack Controller HA (3)