你好,游客 登录 注册 搜索
背景:
阅读新闻

在CentOS 7上安装OpenStack Mitaka版本

[日期:2016-05-03] 来源:Linux社区  作者:youerning [字体:大 中 小]

计算节点

安装

yum install openstack-neutron-linuxbridge ebtables

配置文件 /etc/neutron/neutron.conf

rabbitmq队列

[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS

keystone认证

[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = NEUTRON_PASS

并发锁

[oslo_concurrency]
...
lock_path = /var/lib/neutron/tmp

配置文件/etc/nova/nova.conf

[neutron]
...
url = http://controller:9696
auth_url = http://controller:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = NEUTRON_PASS

重启nova-compute

# systemctl restart openstack-nova-compute.service

启动

# systemctl enable neutron-linuxbridge-agent.service
# systemctl start neutron-linuxbridge-agent.service

验证

$ . admin-openrc
$ neutron ext-list

+---------------------------+-----------------------------------------------+

| alias                    | name                                          |

+---------------------------+-----------------------------------------------+

| default-subnetpools      | Default Subnetpools                          |

| network-ip-availability  | Network IP Availability                      |

| network_availability_zone | Network Availability Zone                    |

| auto-allocated-topology  | Auto Allocated Topology Services              |

| ext-gw-mode              | Neutron L3 Configurable external gateway mode |

| binding                  | Port Binding                                  |

............

Dashboard horizon

注:必须在控制节点


安装

# yum install openstack-dashboard

配置文件/etc/openstack-dashboard/local_settings

OPENSTACK_HOST = "controller"
ALLOWED_HOSTS = ['*', ]
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 'controller:11211',
    }
}
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 2,
}
OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = "default"
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
OPENSTACK_NEUTRON_NETWORK = {
    ...
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_vpn': False,
    'enable_fip_topology_check': False,
}
TIME_ZONE = "Asia/Shanghai"

启动

# systemctl restart httpd.service memcached.service

验证

访问http://controller/dashboard

块存储 cinder

数据库

$ mysql -u root -p
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
  IDENTIFIED BY 'CINDER_DBPASS';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
  IDENTIFIED BY 'CINDER_DBPASS';

创建service,user,role

$ . admin-openrc
$ openstack user create --domain default --password-prompt cinder
$ openstack role add --project service --user cinder admin

注意,这里创建两个service

$ openstack service create --name cinder \
  --description "OpenStack Block Storage" volume
$ openstack service create --name cinderv2 \
  --description "OpenStack Block Storage" volumev2

创建endpoint,依次有public,internal,admin

$ openstack endpoint create --region RegionOne \
  volume public http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
  volume internal http://controller:8776/v1/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
  volume admin http://controller:8776/v1/%\(tenant_id\)s

注意,每个service对应三个endpoint

$ openstack endpoint create --region RegionOne \
  volumev2 public http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
  volumev2 internal http://controller:8776/v2/%\(tenant_id\)s
$ openstack endpoint create --region RegionOne \
  volumev2 admin http://controller:8776/v2/%\(tenant_id\)s

安装

控制节点

# yum install openstack-cinder

配置文件/etc/cinder/cinder.conf

数据库

[database]
...
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder

rabbitmq队列

[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS

keystone认证

[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS

绑定ip

[DEFAULT]
...
my_ip = 10.0.0.11

并行锁

[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp

同步数据库

# su -s /bin/sh -c "cinder-manage db sync" cinder

配置文件/etc/nova/nova.conf

[cinder]
os_region_name = RegionOne

重启nova-api

# systemctl restart openstack-nova-api.service

启动

# systemctl enable openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl start openstack-cinder-api.service openstack-cinder-scheduler.service

其他节点,可在计算节点加一块硬盘

注:需要另外一块硬盘

安装

# yum install lvm2
# systemctl enable lvm2-lvmetad.service
# systemctl start lvm2-lvmetad.service

创建逻辑卷

# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created

# vgcreate cinder-volumes /dev/sdb
Volume group "cinder-volumes" successfully created

配置文件/etc/lvm/lvm.conf

devices {
...
filter = [ "a/sdb/", "r/.*/"]

注:新添加的硬盘一般为sdb,如果有sdc,sde等,则为filter = [ "a/sdb/", "a/sdb/","a/sdb/","r/.*/"],以此类推

安装

# yum install openstack-cinder targetcli

配置文件/etc/cinder/cinder.conf

数据库

1
2
3 [database]
...
connection = mysql+pymysql://cinder:CINDER_DBPASS@controller/cinder

rabbitmq队列

[DEFAULT]
...
rpc_backend = rabbit
[oslo_messaging_rabbit]
...
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = RABBIT_PASS

keystone认证

[DEFAULT]
...
auth_strategy = keystone
[keystone_authtoken]
...
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = CINDER_PASS

绑定ip

[DEFAULT]
...
my_ip = 10.0.0.102

增加[lvm]及其内容

[lvm]
...
volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
volume_group = cinder-volumes
iscsi_protocol = iscsi
iscsi_helper = lioadm

后端启用lvm

[DEFAULT]
...
enabled_backends = lvm

配置Glance API

1
2
3 [DEFAULT]
...
glance_api_servers = http://controller:9292

并行锁

[oslo_concurrency]
...
lock_path = /var/lib/cinder/tmp

启动

# systemctl enable openstack-cinder-volume.service target.service
# systemctl start openstack-cinder-volume.service target.service

验证

$ . admin-openrc
$ cinder service-list

+------------------+------------+------+---------+-------+----------------------------+-----------------+

|      Binary      |    Host    | Zone |  Status | State |        Updated_at        | Disabled Reason |

+------------------+------------+------+---------+-------+----------------------------+-----------------+

| cinder-scheduler | controller | nova | enabled |  up  | 2014-10-18T01:30:54.000000 |      None      |

| cinder-volume    | block1@lvm | nova | enabled |  up  | 2014-10-18T01:30:57.000000 |      None      |

至此。基本上完成了,所有的安装,你可以在dashboard上首先用admin用户创建一个网络,然后用新建一个实例

后记:虽然手动安装一整套实在有点夸张,这里还是用yum的呢~但是至少得这么手动来一次,其他时候就脚本或者安装工具吧,复制粘贴都把我复制的眼花了~

其他组件就另起一篇文章了,值得注意的是,官方文档才是最好的文档

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-05/130933.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款