在控制节点上,nova-api负责虚拟机生命周期的操作,nova-scheduler实现控制在哪个计算节点上启动实例,nova-conductor主要是防止云端上计算节点直接访问数据库。需要明确的一点是,控制节点上没有提供计算资源虚拟化功能,都是由计算节点上的nova-compute来完成供给实例计算资源。
1)在controller1上创建nova数据库
```
MariaDB [(none)]> CREATE DATABASE nova;
MariaDB [(none)]> CREATE DATABASE nova_api;
```
2)在controller1创建数据库用户并赋予权限
```
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'yjscloud';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'yjscloud';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'yjscloud';
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'yjscloud';
```
3)在controller1上创建nova用户及赋予admin权限
```
source /root/admin-openrc
openstack user create --domain default nova --password yjscloud
openstack role add --project service --user nova admin
```
4)在controller1上创建computer服务
```
openstack service create --name nova --description "OpenStack Compute" compute
```
5)在controller1创建nova的endpoint
```
openstack endpoint create --region RegionOne compute public http://yjscloud.com:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute internal http://yjscloud.com:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region RegionOne compute admin http://yjscloud.com:8774/v2.1/%\(tenant_id\)s
```
6)在controller1、2、3上安装nova相关软件
```
yum install -y openstack-nova-api openstack-nova-conductor openstack-nova-cert openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
7)在controller1、2、3上配置nova的配置文件/etc/nova/nova.conf
cp /etc/nova/nova.conf /etc/nova/nova.conf.bak
>/etc/nova/nova.conf
openstack-config --set /etc/nova/nova.conf DEFAULT debug False
openstack-config --set /etc/nova/nova.conf DEFAULT verbose True
openstack-config --set /etc/nova/nova.conf DEFAULT enabled_apis osapi_compute,metadata
openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_listen_port 9774
openstack-config --set /etc/nova/nova.conf DEFAULT metadata_listen_port 9775
openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 10.1.1.150
openstack-config --set /etc/nova/nova.conf DEFAULT use_neutron True
openstack-config --set /etc/nova/nova.conf DEFAULT firewall_driver nova.virt.firewall.NoopFirewallDriver
openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend rabbit
openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_use_baremetal_filters False
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_default_filters RamFilter,CoreFilter,DiskFilter
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_weight_classes nova.scheduler.weights.all_weighers
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_host_subset_size 30
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_driver nova.scheduler.filter_scheduler.FilterScheduler
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_max_attempts 3
openstack-config --set /etc/nova/nova.conf DEFAULT scheduler_available_filters nova.scheduler.filters.all_filters
openstack-config --set /etc/nova/nova.conf DEFAULT ram_allocation_ratio 3.0
openstack-config --set /etc/nova/nova.conf DEFAULT disk_allocation_ratio 1.0
openstack-config --set /etc/nova/nova.conf DEFAULT cpu_allocation_ratio 16.0
openstack-config --set /etc/nova/nova.conf DEFAULT service_down_time 180
openstack-config --set /etc/nova/nova.conf DEFAULT osapi_compute_workers 4
openstack-config --set /etc/nova/nova.conf DEFAULT metadata_workers 4
openstack-config --set /etc/nova/nova.conf DEFAULT rootwrap_config /etc/nova/rootwrap.conf
openstack-config --set /etc/nova/nova.conf DEFAULT notify_on_state_change vm_and_task_state
openstack-config --set /etc/nova/nova.conf DEFAULT allow_resize_to_same_host True
openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_host 10.1.1.150
openstack-config --set /etc/nova/nova.conf DEFAULT novncproxy_port 6080
openstack-config --set /etc/nova/nova.conf database connection mysql+pymysql://nova:yjscloud@yjscloud.com/nova
openstack-config --set /etc/nova/nova.conf database idle_timeout 3600
openstack-config --set /etc/nova/nova.conf database max_pool_size 30
openstack-config --set /etc/nova/nova.conf database retry_interval 2
openstack-config --set /etc/nova/nova.conf database max_retries -1
openstack-config --set /etc/nova/nova.conf api_database connection mysql+pymysql://nova:yjscloud@yjscloud.com/nova_api
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_hosts controller1:5672,controller2:5672,controller3:5672
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_userid openstack
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_password yjscloud
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_use_ssl False
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_ha_queues True
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_interval 1
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_retry_backoff 2
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit rabbit_max_retries 0
openstack-config --set /etc/nova/nova.conf oslo_messaging_rabbit amqp_durable_queues False
openstack-config --set /etc/nova/nova.conf oslo_concurrency lock_path /var/lib/nova/tmp
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://yjscloud.com:5000
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_url http://yjscloud.com:35357
openstack-config --set /etc/nova/nova.conf keystone_authtoken memcached_servers controller1:11211,controller2:11211,controller3:11211
openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_type password
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken user_domain_name default
openstack-config --set /etc/nova/nova.conf keystone_authtoken project_name service
openstack-config --set /etc/nova/nova.conf keystone_authtoken username nova
openstack-config --set /etc/nova/nova.conf keystone_authtoken password yjscloud
openstack-config --set /etc/nova/nova.conf glance api_servers http://yjscloud.com:9292
openstack-config --set /etc/nova/nova.conf conductor use_local False
openstack-config --set /etc/nova/nova.conf conductor workers 4
openstack-config --set /etc/nova/nova.conf vnc enabled True
openstack-config --set /etc/nova/nova.conf vnc vncserver_listen 0.0.0.0
openstack-config --set /etc/nova/nova.conf vnc vncserver_proxyclient_address 10.1.1.150
openstack-config --set /etc/nova/nova.conf vnc novncproxy_base_url http://192.168.0.168:6080/vnc_auto.html
openstack-config --set /etc/nova/nova.conf neutron url http://yjscloud.com:9696
openstack-config --set /etc/nova/nova.conf neutron auth_url http://yjscloud.com:35357
openstack-config --set /etc/nova/nova.conf neutron auth_plugin password
openstack-config --set /etc/nova/nova.conf neutron project_domain_id default
openstack-config --set /etc/nova/nova.conf neutron user_domain_id default
openstack-config --set /etc/nova/nova.conf neutron region_name RegionOne
openstack-config --set /etc/nova/nova.conf neutron project_name service
openstack-config --set /etc/nova/nova.conf neutron username neutron
openstack-config --set /etc/nova/nova.conf neutron password yjscloud
openstack-config --set /etc/nova/nova.conf neutron service_metadata_proxy True
openstack-config --set /etc/nova/nova.conf neutron metadata_proxy_shared_secret yjscloud
openstack-config --set /etc/nova/nova.conf cinder os_region_name RegionOne
```
```
scp -p /etc/nova/nova.conf controller2:/etc/nova/nova.conf
scp -p /etc/nova/nova.conf controller3:/etc/nova/nova.conf
```
**注意修改ip**
8)在controller1同步nova数据
```
su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova
```
9)在controller1上设置开机启动
```
systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
```
controller2、3上设置开机启动(注意比controller1节点少了`openstack-nova-consoleauth.service`):
```
systemctl enable openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
```
controller1上启动nova服务:
```
systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
```
controller2、3上启动nova服务:
```
systemctl restart openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl status openstack-nova-api.service openstack-nova-cert.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl list-unit-files | grep openstack-noca-*
```
10)随便一个节点上验证nova服务
```
unset OS_TOKEN OS_URL
echo "export OS_REGION_NAME=RegionOne" >> admin-openrc
source /root/admin-openrc
nova service-list
openstack endpoint list
```
- 献给我的朋友们
- 一、个人对学习的看法
- 二、运维技能图谱
- 三、运维常用技能
- 3.1 Vim(最好用的编辑器)
- 3.2 Nginx & Tengine(Web服务)
- 1. Nginx介绍和部署
- 2. Nginx配置解析
- 3. Nginx常用模块
- 4. Nginx 的session 一致性问题
- 3.3 Tomcat(Web中间件)
- 3.4 Keepalived(负载均衡高可用)
- 3.5 Memcache(分布式缓存)
- 3.6 Zookeeper(分布式协调系统)
- 3.7 KVM(开源虚拟化)
- 1. 虚拟化介绍
- 2. KVM基础
- 3. 设置VNC和时间同步
- 4. kvm虚拟机快照备份
- 5. kvm虚拟机在线扩展磁盘
- 6. kvm虚拟机静态迁移
- 7. kvm虚拟机动态迁移
- 8. kvm虚拟机存储池配置
- 9. cpu添加虚拟化功能
- 3.8 GitLab(版本控制)
- 3.8.1 GitLab安装与汉化
- 3.9 Jenkins(运维自动化)
- 3.10 WAF(Web防火墙)
- 3.10.1初探WAF
- 四、常用数据库
- 4.1 MySQL(关系型数据库)
- 1. MySQL源码安装
- 4.2 Mongodb(适用与大数据分析的数据库)
- 4.3 Redis(非关系数据库)
- 五、自动化运维工具
- 5.1 Cobbler(系统自动化部署)
- 5.2 Ansible(自动化部署)
- 5.3 Puppet(自动化部署)
- 5.4 SaltStack(自动化运维)
- 六、存储
- 6.1 GFS(文件型存储)
- 6.2 Ceph(后端存储)
- 七、运维监控工具
- 7.1 对监控的理解
- 7.2 Zabbix(运维监控)
- 7.2.1 Zabbix简介
- 7.2.2 Zabbix服务部署
- 1. Zabbix服务端部署
- 2. Zabbix客服端部署
- 3. 配置前端展示
- 4. zabbix告警配置
- 7.2.3 Zabbix监控服务
- 1. 监控网络设备
- 2. 自定义Nginx监控
- 7.3 云镜(安全监控)
- 7.4 ELK(日志收集展示)
- 八、运维云平台
- 8.1 OpenStack(开源云操作系统)
- 8.1.1 OpenStack简介
- 8.1.2 实验架构设计
- 8.1.3 集群环境准备
- 8.1.4 controller节点部署
- 1. 安装Mariadb Galera Cluster集群
- 2. 安装RabbitMQ Cluster集群
- 3. 安装Pacemaker
- 4. 安装HAProxy
- 5. 安装配置Keystone
- 6. 安装配置glance
- 1. 制作镜像模板
- 7. 安装配置nova
- 8. 安装配置neutron
- 1. 配置虚拟机网络
- 9. 安装Dashboard
- 10. 安装配置cinder
- 8.1.5 compute节点部署
- 1. 安装相关软件包
- 2. 安装Neutron
- 3. 配置cinder
- 4. 创建第一个虚拟机
- 8.1.6 OpenStack报错处理
- 1. cinder僵尸卷删除
- 8.1.7 快速孵化虚拟机方案
- 8.1.8 Kolla容器化部署OpenStack
- 1. 单点部署
- 2. 多节点部署
- 8.2 Tstack(腾讯云平台)
- 8.3 K8s(微服务容器化)
- 九、运维编程技能
- 9.1 Shell(运维必会语言)
- 9.2 Python(万能的胶水语言)
- 十、Devops运维
- 10.1 理念
- 10.2 Devops实战