controller节点

安装环境

配置网络

vim /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=none
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.204.140 #修改自己的ip
PREFIX=24
GATEWAY=192.168.204.2#网关
DNS1=8.8.8.8#


第二块网卡
DEVICE=INTERFACE_NAME
TYPE=Ethernet
ONBOOT="yes"
BOOTPROTO="none"

俩台机器修改主机名字以及关闭防火墙

systemctl stop firewalld

systemctl disable firewalld

setenforce 0

hostnamectl set-hostname controller
##控制节点
hostnamectl set-hostname compute
##被控节点

安装时间服务器chrony以及配置主机映射

vi /etc/hosts//俩台都需要配置
10.1.10.111 controller
10.1.10.112 compute

yum -y install chrony

vim /etc/chrony.conf //controller节点
# Please consider joining the pool  (http://www.pool.ntp.org/join.html).
server ntp1.aliyun.com iburst
# Allow NTP client access from local network.
allow all
vim /etc/chrony.conf //compute节点
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.204.140  iburst //上面配置的名字也行eg:controller
chronyc sources -v //检查是否成功,^*代表成功

安装OpenStack包

yum install centos-release-openstack-stein -y
yum install python-openstackclient -y
yum install openstack-selinux -y

安装数据库

vim /etc/my.cnf.d/openstack.cnf

# 配置文件内容
[mysqld]
bind-address = 控制节点IP//注意是controller机器
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

安装数据库
yum install mariadb-server -y

启动数据库
systemctl start mariadb.service;systemctl enable mariadb.service

初始化数据库
mysql_secure_installation
yynyy

删除maridb数据库
yum remove mariadb
删除遗留的目录:
rm -rf /etc/my.cnf
rm -rf /var/lib/mysql

安装消息队列rabbitmq (controller)

yum install rabbitmq-server -y

启动和开机自动启动
systemctl enable rabbitmq-server.service;systemctl start rabbitmq-server.service

添加OpenStack用户
rabbitmqctl add_user openstack admin

允许用户进行配置、写入和读取访问 openstack
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

查看服务
rabbitmq-plugins list

开启图形化界面
rabbitmq-plugins enable rabbitmq_management rabbitmq_management_agent

查看
ip:15672  
用户名:guest 
密码:guest

安装memcached

yum install memcached python-memcached -y

vim /etc/sysconfig/memcached
配置文件内容
OPTIONS="*"

开机启动和自启
systemctl enable memcached.service;systemctl start memcached.service

各个节点安装

keystone节点

进入数据库
mysql -u root -padmin
创建数据库
MariaDB [(none)]> CREATE DATABASE keystone;
授予对数据库的适当访问权限:keystone
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \
IDENTIFIED BY 'admin';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \
IDENTIFIED BY 'admin';
退出数据库访问客户端。
下载keystone
yum install openstack-keystone httpd mod_wsgi -y
修改
vim /etc/keystone/keystone.conf
[database]
# ...
connection = mysql+pymysql://keystone:admin@controller/keystone
[token]
# ...
provider = fernet
填充标识服务数据库:
su -s /bin/sh -c "keystone-manage db_sync" keystone
创建令牌:
# keystone-manage fernet_setup --keystone-user keystone --keystone-group keystone
# keystone-manage credential_setup --keystone-user keystone --keystone-group keystone

keystone-manage bootstrap --bootstrap-password admin \
  --bootstrap-admin-url http://10.1.31.50:5000/v3/ \
  --bootstrap-internal-url http://10.1.31.50:5000/v3/ \
  --bootstrap-public-url http://10.1.31.50:5000/v3/ \
  --bootstrap-region-id RegionOne
配置Apache
 vi /etc/httpd/conf/httpd.conf
 ServerName www.example.com:80 //找到
添加  ServerName controller
创建软连接
 ln -s /usr/share/keystone/wsgi-keystone.conf /etc/httpd/conf.d/

 启动和开机自启
 systemctl enable httpd.service;systemctl start httpd.service

 通过设置适当的环境变量来配置管理帐户:
 vim admin.sh(官方文档名字为clouds.yaml)
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3

source admin.sh
 检验openstack是否可以使用
 openstack endpoint list
创建域
openstack domain create --description "An Example Domain" example

创建项目
openstack project create --domain default --description "Service Project" service

常规(非管理员)任务应使用非特权项目和用户。例如,本指南创建myproject项目和myuser 用户。
openstack project create --domain default --description "Demo Project" myproject

创建myuser用户:
openstack user create --domain default --password-prompt myuser #设置myuser密码为:admin

创建myrole角色:
openstack role create myrole

将myrole角色添加到myproject项目和myuser用户:
openstack role add --project myproject --user myuser myrole

取消设置的临时和环境变量
unset OS_AUTH_URL OS_PASSWORD

需要输入admin密码 //密码为admin.sh
openstack --os-auth-url http://controller:5000/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name admin --os-username admin token issue

需要输入myuser密码:
openstack --os-auth-url http://controller:5000/v3 --os-project-domain-name Default --os-user-domain-name Default --os-project-name myproject --os-username myuser token issue
//admin这是密码

创建admin的环境变量
vim admin.sh
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
创建myuser的环境变量
vim myuser.sh(官方文档名字为demo-openrc)
export OS_PROJECT_DOMAIN_NAME=Default
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=myproject
export OS_USERNAME=myuser
export OS_PASSWORD=1
export OS_AUTH_URL=http://controller:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2

source admin.sh
source myuser.sh

glance节点

创建数据库
CREATE DATABASE glance;

授予对glance数据库的适当访问权限:
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \
  IDENTIFIED BY 'admin';
退出数据库然后获取admin凭据以访问仅限管理员的 CLI 命令:
source admin.sh

创建glance用户:
openstack user create --domain default --password-prompt glance #密码:adminadmin角色添加到glance用户和 service项目:
openstack role add --project service --user glance admin

创建glance服务实体:
openstack service create --name glance --description "OpenStack Image" image

创建图像服务 API 端点:
openstack endpoint create --region RegionOne image public http://controller:9292
openstack endpoint create --region RegionOne image internal http://controller:9292
openstack endpoint create --region RegionOne image admin http://controller:9292

安装软件包
yum install openstack-glance -y   

配置glance文件
vim /etc/glance/glance-api.conf
[database]
connection = mysql+pymysql://glance:admin@controller/glance

在[keystone_authtoken]和[paste_deploy]部分中,配置身份服务访问:
[keystone_authtoken]
www_authenticate_uri  = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = admin

[paste_deploy]
flavor = keystone

在该[glance_store]部分中,配置本地文件系统存储和图像文件的位置:
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
vim  /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:admin@controller/glance
[keystone_authtoken]
www_authenticate_uri  = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = admin
[paste_deploy]

# ..

flavor = keystone
同步数据库
su -s /bin/sh -c "glance-manage db_sync" glance

启动自启服务
systemctl enable openstack-glance-api.service;systemctl start openstack-glance-api.service
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
//下载镜像
验证:上传镜像
glance image-create --name "cirros" --file cirros-0.4.0-x86_64-disk.img --disk-format qcow2 --container-format bare --visibility public

placement组件

创建placement数据库:
CREATE DATABASE placement;

授予对数据库的适当访问权限:
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON placement.* TO 'placement'@'localhost' \
  IDENTIFIED BY 'admin';
退出数据库,然后获取admin凭据以访问仅限管理员的 CLI 命令:
source admin.sh

使用您选择的创建放置服务用户PLACEMENT_PASS:
openstack user create --domain default --password-prompt placement  #设置密码:admin

将 Placement 用户添加到具有管理员角色的服务项目中:
openstack role add --project service --user placement admin

在服务目录中创建 Placement API 条目:
openstack service create --name placement --description "Placement API" placement

创建 Placement API 服务端点:
openstack endpoint create --region RegionOne placement public http://controller:8778
openstack endpoint create --region RegionOne placement internal http://controller:8778
openstack endpoint create --region RegionOne placement admin http://controller:8778

安装软件包:
yum install openstack-placement-api -y


vim /etc/placement/placement.conf
在该[placement_database]部分中,配置数据库访问:

[placement_database]
connection = mysql+pymysql://placement:admin@controller/placement

在[api]和[keystone_authtoken]部分中,配置身份服务访问:
[api]
auth_strategy = keystone

[keystone_authtoken]
auth_url = http://controller:5000/v3
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = placement
password = admin

同步数据库
su -s /bin/sh -c "placement-manage db sync" placement

bug 如果httpd的版本大于2.4需要配置(最后面添加)
vim /etc/httpd/conf.d/00-placement-api.conf
<Directory /usr/bin>
   <IfVersion >= 2.4>
      Require all granted
   </IfVersion>
   <IfVersion < 2.4>
      Order allow,deny
      Allow from all
   </IfVersion>
</Directory>


重启服务
systemctl restart httpd

验证
source admin.sh
placement-status upgrade check

nova节点

创建nova_api、nova和nova_cell0数据库:
CREATE DATABASE nova_api;
CREATE DATABASE nova;
CREATE DATABASE nova_cell0;

授予对数据库的适当访问权限:
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'admin';

GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'%' IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON nova_cell0.* TO 'nova'@'localhost' \
  IDENTIFIED BY 'admin';

退出数据库,然后加载权限
创建nova用户:
openstack user create --domain default --password-prompt nova #设置密码:adminadmin角色添加到nova用户:
openstack role add --project service --user nova admin

创建nova服务实体:
openstack service create --name nova --description "OpenStack Compute" compute

创建计算 API 服务端点:
openstack endpoint create --region RegionOne compute public http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute internal http://controller:8774/v2.1
openstack endpoint create --region RegionOne compute admin http://controller:8774/v2.1


安装软件包:
yum install openstack-nova-api openstack-nova-conductor openstack-nova-novncproxy openstack-nova-scheduler -y//提供数据库连接、、访问云主机、、负责调度
vim /etc/nova/nova.conf
在该[DEFAULT]部分中,仅启用计算和元数据 API:

[DEFAULT]
enabled_apis = osapi_compute,metadata
在[api_database]和[database]部分中,配置数据库访问:

[api_database]
connection = mysql+pymysql://nova:admin@controller/nova_api

[database]
connection = mysql+pymysql://nova:admin@controller/nova

在该[DEFAULT]部分中,配置RabbitMQ消息队列访问:
[DEFAULT]
transport_url = rabbit://openstack:admin@controller:5672/

#注意,此处密码同消息队列中创建openstack用户的密码
my_ip = 10.1.31.20
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver



在[api]和[keystone_authtoken]部分中,配置身份服务访问:

[api]
auth_strategy = keystone

[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = admin

[vnc]
enabled = true
server_listen = $my_ip
server_proxyclient_address = $my_ip

[glance]
api_servers = http://controller:9292

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = admin

同步数据库
su -s /bin/sh -c "nova-manage api_db sync" nova

注册cell0数据库:
su -s /bin/sh -c "nova-manage cell_v2 map_cell0" nova

创建cell1单元格:
su -s /bin/sh -c "nova-manage cell_v2 create_cell --name=cell1 --verbose" nova

填充新星数据库:
su -s /bin/sh -c "nova-manage db sync" nova

验证 nova cell0 和 cell1 是否正确注册:
su -s /bin/sh -c "nova-manage cell_v2 list_cells" nova

启动自启服务
systemctl enable \
    openstack-nova-api.service \
    openstack-nova-scheduler.service \
    openstack-nova-conductor.service \
    openstack-nova-novncproxy.service
systemctl restart \
    openstack-nova-api.service \
    openstack-nova-scheduler.service \
    openstack-nova-conductor.service \
    openstack-nova-novncproxy.service





计算节点配置
安装软件包
yum install openstack-nova-compute -y

vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:admin@controller
my_ip = 10.100.11.35
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api]
auth_strategy = keystone

[keystone_authtoken]
www_authenticate_uri = http://controller:5000/
auth_url = http://controller:5000/
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = admin

[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]
api_servers = http://controller:9292

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = admin

查看是否支持CPU虚拟化
egrep -c '(vmx|svm)' /proc/cpuinfo

如为零配置
[libvirt]
virt_type = qemu

启动服务自启
systemctl enable libvirtd.service openstack-nova-compute.service;systemctl start libvirtd.service openstack-nova-compute.service

验证(控制节点)
 openstack compute service list --service nova-compute//Erroo缺少admin.sh,加入admin就好了

主机发现
su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova
Erroo缺少admin.sh,加入admin就好了

neutron计算节点

配置文件
vim /etc/neutron/neutron.conf
[database]
transport_url = rabbit://openstack:admin@controller
[DEFAULT]
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = admin
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

vim /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = linuxbridge

vim /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_host = 10.100.11.34
metadata_proxy_shared_secret = admin
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
[agent]
extensions=qos
dscp=8
dscp_inherit = true
vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
modprobe br_netfilter
sysctl -p

vim /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = admin
重启服务
systemctl enable neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
systemctl restart neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
systemctl restart openstack-nova-compute.service

neutron节点

mysql -u root -padmin //进入数据库创建用户授权
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' \
  IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' \
  IDENTIFIED BY 'admin';
创建neutron用户:
openstack user create --domain default --password-prompt neutron //密码为adminadmin角色添加到neutron用户:
openstack role add --project service --user neutron admin
创建neutron服务实体:
openstack service create --name neutron --description "OpenStack Networking" network

创建网络服务 API 端点:
openstack endpoint create --region RegionOne network public http://controller:9696
openstack endpoint create --region RegionOne network internal http://controller:9696
openstack endpoint create --region RegionOne network admin http://controller:9696
安装服务
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y

配置文件
vim /etc/neutron/neutron.conf
[database]
connection = mysql+pymysql://neutron:admin@controller/neutron
[DEFAULT]
core_plugin = ml2
service_plugins = router
allow_overlapping_ips = true
transport_url = rabbit://openstack:admin@controller
auth_strategy = keystone
notify_nova_on_port_status_changes = true
notify_nova_on_port_data_changes = true
dhcp_agents_per_network = 2
l3_ha = true
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = admin
[nova]
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = nova
password = admin
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
vim  /etc/neutron/plugins/ml2/ml2_conf.ini
[ml2]
type_drivers = flat,vlan
tenant_network_types = flat,vlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security,qos
[ml2_type_vlan]
flat_networks = provider
network_vlan_ranges = provider:3000:3399
[securitygroup]
enable_ipset = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
modprobe br_netfilter
sysctl -p
vim /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = admin
service_metadata_proxy = true
metadata_proxy_shared_secret = admin
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini


su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
systemctl restart openstack-nova-api.service
systemctl enable neutron-server.service 
systemctl start neutron-server.service

dashboard

下载bashboard
yum install openstack-dashboard -y
配置文件
vim /etc/openstack-dashboard/local_settings
找到 OPENSTACK_HOST = 修改为controller的ip地址
找到ALLOWED_HOSTS修改为ALLOWED_HOSTS = ["*"]
找到SESSION_ENGINE修改为SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
找到#CACHES修改为
CACHES = {
    'default': {
         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
         'LOCATION': 'controller:11211',
    }
}

找到#OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT修改为OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True

找到#OPENSTACK_API_VERSIONS修改为
OPENSTACK_API_VERSIONS = {
    "identity": 3,
    "image": 2,
    "volume": 3,
    "compute": 2,
}
找到#OPENSTACK_KEYSTONE_DEFAULT_DOMAIN修改为OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
找到OPENSTACK_KEYSTONE_DEFAULT_ROLE修改为OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"
找到TIME_ZONE = "UTC"修改为TIME_ZONE = "Asia/Shanghai"|g'
vim /etc/httpd/conf.d/openstack-dashboard.conf
WSGIApplicationGroup %{GLOBAL}

重启服务
systemctl restart httpd.service memcached.service

访问不了页面
在 /etc/openstack-dashboard/local_settings文件中添加
WEBROOT = "/dashboard"(在197行)
访问页面是ip号加上http://10.100.11.34/dashboard

cinder节点

进入数据库创建用户并授权
mysql -uroot -padmin
CREATE DATABASE cinder;
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'localhost' \
  IDENTIFIED BY 'admin';
GRANT ALL PRIVILEGES ON cinder.* TO 'cinder'@'%' \
  IDENTIFIED BY 'admin';

source admin.sh

创建用户:cinder
openstack user create --domain default --password-prompt cinder    //密码为admin

角色添加到用户:admincinder
openstack role add --project service --user cinder admin

创建和服务实体:cinderv2cinderv3
openstack service create --name cinderv2 \
  --description "OpenStack Block Storage" volumev2
openstack service create --name cinderv3 \
  --description "OpenStack Block Storage" volumev3

 创建块存储服务API端点:
openstack endpoint create --region RegionOne \
  volumev2 public http://controller:8776/v2/%\(project_id\)s

openstack endpoint create --region RegionOne \
  volumev2 internal http://controller:8776/v2/%\(project_id\)s

openstack endpoint create --region RegionOne \
  volumev2 admin http://controller:8776/v2/%\(project_id\)s

openstack endpoint create --region RegionOne \
  volumev3 public http://controller:8776/v3/%\(project_id\)s

openstack endpoint create --region RegionOne \
  volumev3 internal http://controller:8776/v3/%\(project_id\)s

openstack endpoint create --region RegionOne \
  volumev3 admin http://controller:8776/v3/%\(project_id\)s 

  安装软件包
 yum install openstack-cinder
 编辑文件
 配置数据库的访问
v /etc/cinder/cinder.conf
[database]
# ...
connection = mysql+pymysql://cinder:admin@controller/cinder
配置消息队列访问
[DEFAULT]
# ...
transport_url = rabbit://openstack:admin@controller
配置身份服务访问
[DEFAULT]
# ...
auth_strategy = keystone

[keystone_authtoken]
# ...
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = cinder
password = admin
管理接口的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
重新启动计算 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

计算节点

安装环境

看controller就是完成网卡,时间同步,防火墙以及安装包就可以了

各个节点的安装

nova节点

安装软件包
yum install openstack-nova-compute libguestfs-tools -y
vim /etc/nova/nova.conf
[DEFAULT]
enabled_apis = osapi_compute,metadata
transport_url = rabbit://openstack:admin@controller
my_ip = 本机ip
use_neutron = true
firewall_driver = nova.virt.firewall.NoopFirewallDriver

[api]
auth_strategy = keystone

[keystone_authtoken]
auth_url = http://10.1.31.50:5000/v3
memcached_servers = 10.1.31.50:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = nova
password = admin

[vnc]
enabled = true
server_listen = 0.0.0.0
server_proxyclient_address = $my_ip
novncproxy_base_url = http://controller:6080/vnc_auto.html

[glance]
api_servers = http://controller:9292

[oslo_concurrency]
lock_path = /var/lib/nova/tmp

[placement]
region_name = RegionOne
project_domain_name = Default
project_name = service
auth_type = password
user_domain_name = Default
auth_url = http://controller:5000/v3
username = placement
password = admin

[libvirt]
virt_type = qemu
重启服务
systemctl enable libvirtd.service openstack-nova-compute.service
systemctl restart libvirtd.service openstack-nova-compute.service

neutron节点

安装包
yum install  openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
配置文件
vim /etc/neutron/neutron.conf
[DEFAULT]
transport_url = rabbit://openstack:admin@controller
auth_strategy = keystone
[keystone_authtoken]
www_authenticate_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = admin
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp

vim /etc/neutron/dhcp_agent.ini
[DEFAULT]
interface_driver = linuxbridge
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = true

vim /etc/neutron/l3_agent.ini
[DEFAULT]
interface_driver = linuxbridge

vim /etc/neutron/metadata_agent.ini
[DEFAULT]
nova_metadata_host = controllerip地址
metadata_proxy_shared_secret = admin
vim /etc/neutron/plugins/ml2/linuxbridge_agent.ini
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = false
[securitygroup]
enable_security_group = true
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
[agent]
extensions=qos
dscp=8
dscp_inherit = true
vim /etc/sysctl.conf
net.bridge.bridge-nf-call-iptables=1
net.bridge.bridge-nf-call-ip6tables=1
modprobe br_netfilter
sysctl -p

vim /etc/nova/nova.conf
[neutron]
url = http://controller:9696
auth_url = http://controller:5000
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = RegionOne
project_name = service
username = neutron
password = admin
重启服务
systemctl enable neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
systemctl restart neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service neutron-l3-agent.service
systemctl restart openstack-nova-compute.service

openstack命令

openstack endpoint list
openstack endpoint delete id号
openstack network agent list
openstack compute service
openstack volume list 查看卷

错误排查

如果进行图形化界面管理报错

首先source admin.sh
openstack catalog list//检查是否建了俩个相同的表格
进入数据库
show databases;
use keystone;
select * from service;
DELETE FROM service WHERE id = '9eeecea9c3b04d68baf2003cddfe0ffc'//删除

遇到没有可创建资源的问题(NoValidHost_Remote: No valid host was found. There are not enough hosts available.)

用Navicat 软件进入连接,找到placement中的resource_providers找到uuid
再找到nova中的compute_nodes找到uuid保持一致

没有单元格映射

su -s /bin/sh -c "nova-manage cell_v2 discover_hosts --verbose" nova

controller控制器连接不上

compute节点novncproxy_base_url = http://10.100.11.34:6080/vnc_auto.html 将controllerg
vim /etc/nova/nova.conf
重启服务

遇到Exceeded maximum number of retries. Exhausted all hosts available for retrying build failures for instance 40018f66-c156-49ae-9399-c99fcffbf106.

重启服务openstack network agent list 查看有没有服务,如果没有服务查看vim /etc/neutron/neutron.conf
[DEFAULT]
transport_url = rabbit://openstack:admin@controller
auth_strategy = keystone
是否将这个写进别的地方
一共四个服务确定都起来
大概就是这么着

image-20230825103138327

作者:严锋  创建时间:2023-09-10 21:44
最后编辑:严锋  更新时间:2025-05-09 15:48