1. 程式人生 > >OpenStack雙節點部署—M ceilometer(監測服務)

OpenStack雙節點部署—M ceilometer(監測服務)

ceilometeran安裝

一、安裝、配置並使用mongodb 資料庫

Controller節點

1.安裝配置mongodb

#  yum install -y mongodb-server mongodb

# vi /etc/mongod.conf
bind_ip = 192.168.100.10
smallfiles = true

2.啟動mongodb 資料庫並設定開機自啟

# systemctl enable mongod.service
# systemctl start mongod.service

3.建立ceilometer非關係資料庫

# mongo --host controller --eval '
  db = db.getSiblingDB("ceilometer");
  db.createUser({user: "ceilometer",
  pwd: "123456",
  roles: [ "readWrite", "dbAdmin" ]})'

在這裡插入圖片描述

二、建立服務憑證和API端點

Controller節點

1.建立服務憑證

# . /root/admin-openrc
# openstack user create --domain default --password-prompt ceilometer
User Password:
Repeat User Password:
# openstack role add --project service --user ceilometer admin
# openstack service create --name ceilometer \
   --description "Telemetry" metering

在這裡插入圖片描述
2.建立API端點

# openstack endpoint create --region RegionOne \
   metering public http://controller:8777
# openstack endpoint create --region RegionOne \
   metering internal http://controller:8777
#  openstack endpoint create --region RegionOne \
   metering admin http://controller:8777

在這裡插入圖片描述

三、安裝並配置監測服務

1.安裝並配置ceilometer

Controller節點

1)安裝ceilometer相關包

# yum install -y openstack-ceilometer-api \
openstack-ceilometer-collector openstack-ceilometer-notification \
   openstack-ceilometer-central python-ceilometerclient

2)配置/etc/ceilometer/ceilometer.conf檔案

# vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone

[database]
connection = mongodb://ceilometer:[email protected]:27017/ceilometer

[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456

[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 = ceilometer
password = 123456

[service_credentials]
auth_type = password
auth_url = http://controller:5000/v3
project_domain_name = default
user_domain_name = default
project_name = service
username = ceilometer
password = 123456
interface = internalURL
region_name = RegionOne

3)啟動ceilometer服務並設定開機自啟

# systemctl enable openstack-ceilometer-api.service \
   openstack-ceilometer-notification.service \
   openstack-ceilometer-central.service \
   openstack-ceilometer-collector.service

# systemctl start openstack-ceilometer-api.service \
   openstack-ceilometer-notification.service \
   openstack-ceilometer-central.service \
   openstack-ceilometer-collector.service

2.啟用影象服務表

1)配置/etc/glance/glance-api.conf檔案

# vi /etc/glance/glance-api.conf
[DEFAULT]
rpc_backend = rabbit

[oslo_messaging_notifications]
driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456

2)重啟映象服務

# systemctl restart openstack-glance-api.service openstack-glance-registry.service

3.啟用計算服務表

Compute節點

1)安裝ceilometer相關包

# yum install -y openstack-ceilometer-compute python-ceilometerclient python-pecan

2)配置/etc/ceilometer/ceilometer.conf檔案

# vi /etc/ceilometer/ceilometer.conf
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
instance_usage_audit = True
instance_usage_audit_period = hour
notify_on_state_change = vm_and_task_state
notification_driver = messagingv2

[oslo_messaging_rabbit]
rabbit_host = controller
rabbit_userid = openstack
rabbit_password = 123456

[service_credentials]
auth_type = password
auth_url = http://controller:5000/v3
project_domain_name = default
user_domain_name = default
project_name = service
username = ceilometer
password = 123456
interface = internalURL
region_name = RegionOne

[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 = ceilometer
password = 123456

3)啟動ceilometer服務並設定開機自啟

# systemctl enable openstack-ceilometer-compute.service
# systemctl start openstack-ceilometer-compute.service
# systemctl restart openstack-nova-compute.service

4.啟用塊儲存表

Controller節點、Compute節點

1.編輯/etc/cinder/cinder.conf檔案

# vi /etc/cinder/cinder.conf
[oslo_messaging_notifications]
driver = messagingv2

2.重啟cinder服務

# systemctl restart openstack-cinder-api.service openstack-cinder-scheduler.service
# systemctl restart openstack-cinder-volume.service

5.啟用物件儲存表

Controller節點

1)建立ResellerAdmin角色,並加入ceilometer使用者

# . /root/admin-openrc
# openstack role create ResellerAdmin
# openstack role add --project service --user ceilometer ResellerAdmin

在這裡插入圖片描述
2)安裝相關包

# yum install -y python-ceilometermiddleware

3)編輯/etc/swift/proxy-server.conf檔案

# vi /etc/swift/proxy-server.conf
在[filter:keystoneauth]選項新增admin, user, ResellerAdmin
[filter:keystoneauth]
operator_roles = admin, user, ResellerAdmin

在[pipeline:main]選項新增ceilometer
[pipeline:main]
pipeline = ceilometer catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server

新增[filter:ceilometer]選項
[filter:ceilometer]
paste.filter_factory = ceilometermiddleware.swift:filter_factory
control_exchange = swift
url = rabbit://openstack:[email protected]:5672/
driver = messagingv2
topic = notifications
log_level = WARN

4)重新啟動物件儲存代理服務

# systemctl restart openstack-swift-proxy.service