Openstack云平台搭建课程二·基础服务

这是搭建Openstack云平台的第二堂课,主要讲述公共组件中所需的数据库(MariaDB)、消息队列(RabbitMQ)、缓存(Memcached)和控制面板(Horizon)的配置方法。

部署数据库

安装MariaDB(也可以安装MySQL):

yum -y install mariadb mariadb-server MySQL-python

配置MariaDB

修改配置/etc/my.cnf

[mysqld]
bind-address = 10.10.100.150
default-storage-engine = innodb
innodb_file_per_table
collation-server = utf8_general_ci
character-set-server = utf8

#以下是性能优化方面的配置,请根据实际情况调整
#innodb_flush_method = O_DIRECT
#innodb_file_per_table = 1
#wait_timeout = 28800
#binlog_cache_size = 16M
#max_allowed_packet = 64M
#expire_logs_days = 30
#sort_buffer_size = 128M
#innodb_buffer_pool_size = 512M

初始化MariaDB:

# 启动mariadb
systemctl enable mariadb
systemctl start mariadb
# 初始化mariadb
mysql_secure_installation

依次设置密码(Mariadb123)及初始化数据库。

部署RabbitMQ

安装RabbitMQ

yum -y install rabbitmq-server
systemctl enable rabbitmq-server
systemctl start rabbitmq-server

配置RabbitMQ用户

rabbitmqctl add_user openstack Openstack123
rabbitmqctl set_permissions openstack ".*" ".*" ".*"
rabbitmqctl set_user_tags openstack administrator
# 修改用户密码
# rabbitmqctl change_password <user_name> <new_password>

部署Memcached

# 安装memcached
yum -y install memcached

修改配置/etc/sysconfig/memcached

OPTIONS="-l 10.10.100.150"
# 启动memcached
systemctl enable memcached
systemctl start memcached

部署Dashboard

# 安装dashboard
yum -y install openstack-dashboard

修改配置/etc/openstack-dashboard/local_settings

ALLOWED_HOSTS = ['*', ]

OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 2,
}

OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'

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

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 'controller:11211',
    },
}
OPENSTACK_HOST = "controller"
OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"

OPENSTACK_NEUTRON_NETWORK = {
    'enable_router': False,
    'enable_quotas': False,
    'enable_distributed_router': False,
    'enable_ha_router': False,
    'enable_fip_topology_check': False,
    'enable_lb': False,
    'enable_firewall': False,
    'enable_***': False,
}

TIME_ZONE = "Asia/Shanghai"

注意:需要注释或删除原来的CACHES段中的内容!

原创文章禁止转载:技术学堂 » Openstack云平台搭建课程二·基础服务

精彩评论

9+1=

感谢您的支持与鼓励

支付宝扫一扫打赏

微信扫一扫打赏