MidoNet 安裝(Kilo RDO)(最老版)
阿新 • • 發佈:2017-12-02
encoding yam mys creat cassandra test actor eset ras
一、初始化(Kilo RDO)版(最老版)
環境介紹
系統 | CentOS 7.3 |
---|---|
主機ip | 10.211.55.5 |
主機名 | midonet |
1.配置yum源
###OpenStack源
yum install -y centos-release-openstack-newton.noarch
mv /etc/yum.repos.d/CentOS-OpenStack-newton.repo /etc/yum.repos.d/CentOS-OpenStack-kilo.repo
sed -i
"s/openstack-newton/openstack-kilo/g"
/etc/yum.repos.d/CentOS-OpenStack-kilo.repo
sed -i
"s/mirror.centos.org/buildlogs.centos.org/g"
/etc/yum.repos.d/CentOS-OpenStack-kilo.repo
##Midonet源
yum install yum-plugin-priorities -y
[root
@midonet
~]# cat /etc/yum.repos.d/datastax.repo
[datastax]
name = DataStax Repo
for
Apache Cassandra
baseurl = http:
//rpm.datastax.com/community
enabled =
1
gpgcheck =
1
gpgkey = https:
//rpm.datastax.com/rpm/repo_key
[root
@midonet
~]# cat /etc/yum.repos.d/midonet.repo
[midonet]
name=MidoNet
baseurl=http:
//repo.midonet.org/midonet/v2015.06/RHEL/7/stable/
enabled=
1
gpgcheck=
1
gpgkey=http:
//repo.midonet.org/RPM-GPG-KEY-midokura
[midonet-openstack-integration]
name=MidoNet OpenStack Integration
baseurl=http:
//repo.midonet.org/openstack-kilo/RHEL/7/stable/
enabled=
1
gpgcheck=
1
gpgkey=http:
//repo.midonet.org/RPM-GPG-KEY-midokura
[midonet-misc]
name=MidoNet 3rd Party Tools and Libraries
baseurl=http:
//repo.midonet.org/misc/RHEL/7/misc/
enabled=
1
gpgcheck=
1
gpgkey=http:
//repo.midonet.org/RPM-GPG-KEY-midokura
2.關閉防火墻和selinux
[root
@midonet
~]# getenforce
Disabled
[root
@midonet
~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(
1
)
##如果getenforce不是Disabled
#修改selinux並重啟
sed -ri
"s/(SELINUX=)(.*)/\1=disabled/g"
/etc/selinux/config
reboot
3.下載openstack
yum install python-openstackclient -y --nogpgcheck
yum install openstack-selinux -y --nogpgcheck
4.下載mariadb 並初始化數據庫
yum install -y mariadb mariadb-server MySQL-python --nogpgcheck
systemctl enable mariadb.service
systemctl start mariadb.service
##刪除多余的庫及用戶
mysql -e
"DELETE FROM mysql.user WHERE User=‘‘;"
mysql -e
"DELETE FROM mysql.user WHERE User=‘root‘ AND Host NOT IN (‘localhost‘, ‘127.0.0.1‘, ‘::1‘);"
mysql -e
"DROP DATABASE IF EXISTS test;"
mysql -e
"DELETE FROM mysql.db WHERE Db=‘test‘ OR Db=‘test\\_%‘"
mysql -e
"FLUSH PRIVILEGES;"
5.創建keystone和neutron庫和用戶
mysql -e
"create database keystone;"
mysql -e
"grant all on keystone.* to ‘keystone‘@‘localhost‘ identified by ‘keystone123456‘;"
mysql -e
"grant all on keystone.* to ‘keystone‘@‘%‘ identified by ‘keystone123456‘;"
mysql -e
"create database neutron;"
mysql -e
"grant all on neutron.* to ‘neutron‘@‘localhost‘ identified by ‘neutron123456‘;"
mysql -e
"grant all on neutron.* to ‘neutron‘@‘%‘ identified by ‘neutron123456‘;"
mysql -e
"select user,host from mysql.user;"
6.安裝RabbitMQ
yum install rabbitmq-server -y --nogpgcheck
systemctl start rabbitmq-server.service
systemctl enable rabbitmq-server.servic
二、依賴服務安裝
1.keystone安裝配置
# 生成admin-token
openssl rand -hex
10
> admin-token
# 下載keystone
yum install -y openstack-keystone python-keystoneclient --nogpgcheck
#修改/etc/keystone/keystone.conf配置文件
[root
@midonet
~]# egrep -B
1
"^[a-z]"
/etc/keystone/keystone.conf
[DEFAULT]
admin_token = 6faca30b15bec6ffb8f8
--
[database]
connection=mysql:
//keystone:keystone123456@midonet/keystone
--
[revoke]
driver = keystone.contrib.revoke.backends.sql.Revoke
--
[token]
provider = keystone.token.providers.uuid.Provider
driver = keystone.token.persistence.backends.sql.Token
#初始化
keystone-manage pki_setup --keystone-user keystone --keystone-group keystone
##如果報錯可能是urllib3版本高了
pip install urllib3==
1.16
chown -R keystone:keystone /var/log/keystone
chown -R keystone:keystone /etc/keystone/ssl
chmod -R o-rwx /etc/keystone/ssl
# 同步數據庫
su -s /bin/sh -c
"keystone-manage db_sync"
keystone
#啟動keystone
systemctl enable openstack-keystone
systemctl start openstack-keystone
#配置變量
export OS_TOKEN=6faca30b15bec6ffb8f8
export OS_URL=http:
//midonet:35357/v3
export OS_IDENTITY_API_VERSION=
3
##創建管理用戶admin
openstack project create --domain
default
--description
"Admin Project"
admin
#創建admin用戶
openstack user create --domain
default
--password admin123456 admin
#創建管理規則
openstack role create admin
# 將admin規則給admin租戶和admin用戶添加
openstack role add --project admin --user admin admin
# 創建一個service租戶
openstack project create --domain
default
--description
"Service Project"
service
# 創建服務實體和認證服務
openstack service create --name keystone --description
"OpenStack Identity"
identity
# 創建API endpoint
openstack endpoint create --region RegionOne identity
public
http:
//midonet:5000/v3
openstack endpoint create --region RegionOne identity internal http:
//midonet:5000/v3
openstack endpoint create --region RegionOne identity admin http:
//midonet:35357/v3
# 創建midonet租戶
openstack service create --description
"MidoNet API Service"
midonet
#創建midonet用戶
openstack user create --domain
default
--password midonet123456 midonet
#將midonet添加到admin
openstack role add --project service --user midonet admin
## 配置常用的變量
cat << EOF >> /root/admin-openrc.sh
export OS_TENANT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=admin123456
export OS_AUTH_URL=http:
//midonet:35357/v3
export OS_IDENTITY_API_VERSION=
3
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
EOF
##
unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINT
. /root/admin-openrc.sh
2.neutron安裝
##下載
yum install openstack-neutron python-neutron-plugin-midonet -y --nogpgcheck
#配置neutron網絡
##創建neutron用戶
openstack user create --domain
default
--password neutron123456 neutron
##添加到admin
openstack role add --project service --user neutron admin
###
openstack service create --name neutron --description
"OpenStack Networking"
network
openstack endpoint create --region RegionOne network
public
http:
//midonet:9696
openstack endpoint create --region RegionOne network internal http:
//midonet:9696
openstack endpoint create --region RegionOne network admin http:
//midonet:9696
#修改# /etc/neutron/neutron.conf文件
[root
@midonet
~]# egrep -B
1
"^[a-z]"
/etc/neutron/neutron.conf
[DEFAULT]
core_plugin = neutron.plugins.midonet.plugin.MidonetPluginV2
auth_strategy= keystone
--
[keystone_authtoken]
auth_uri = http:
//127.0.0.1:35357/v2.0/
identity_uri = http:
//127.0.0.1:5000
admin_tenant_name = service
admin_user = neutron
admin_password = neutron123456
[database]
connection = mysql:
//neutron:neutron123456@midonet/neutron
[service_providers]
service_provider = LOADBALANCER:Midonet:midonet.neutron.services.loadbalancer.driver.MidonetLoadbalancerDriver:
default
ervice_plugins = lbaas
--
[oslo_concurrency]
lock_path = $state_path/lock
#新建midonet.ini文件
mkdir /etc/neutron/plugins/midonet
# /etc/neutron/plugins/midonet/midonet.ini
[DATABASE]
sql_connection = mysql:
//neutron:neutron123456@midonet/neutron
[MIDONET]
# MidoNet API URL
midonet_uri = http:
//midonet:8080/midonet-api
# MidoNet administrative user in Keystone
username = midonet
password = midonet123456
# MidoNet administrative user‘s tenant
project_id = service
##建立軟連接
ln -s /etc/neutron/plugins/midonet/midonet.ini /etc/neutron/plugin.ini
###
su -s /bin/sh -c
"neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/midonet/midonet.ini upgrade kilo"
neutron
##啟動neutron
systemctl enable neutron-server.service
systemctl start neutron-server.service
3.安裝zookeeper
yum install java-
1.7
.
0
-openjdk -y --nogpgcheck
yum install zookeeper zkdump nmap-ncat -y --nogpgcheck
##修改/etc/zookeeper/zoo.cfg文件
[root
@midonet
~]# grep -C
2
"server"
/etc/zookeeper/zoo.cfg
# The number of milliseconds of each tick
server.
1
=midonet:
2888
:
3888
tickTime=
2000
# The number of ticks that the initial
##啟動zookeeper
mkdir /var/lib/zookeeper/data
chown zookeeper:zookeeper /var/lib/zookeeper/data
echo
1
> /var/lib/zookeeper/data/myid
mkdir -p /usr/java/
default
/bin/
ln -s /usr/lib/jvm/jre-
1.7
.
0
-openjdk/bin/java /usr/java/
default
/bin/java
systemctl enable zookeeper.service
systemctl start zookeeper.service
##測試
[root
@midonet
~]# echo ruok | nc
127.0
.
0.1
2181
imok
[root
@midonet
~]# echo stat | nc
127.0
.
0.1
2181
Zookeeper version:
3.4
.
5
--
1
, built on
02
/
08
/
2013
12
:
25
GMT
Clients:
/
127.0
.
0.1
:
59460
[
0
](queued=
0
,recved=
1
,sent=
0
)
Latency min/avg/max:
0
/
0
/
0
Received:
2
Sent:
1
Connections:
1
Outstanding:
0
Zxid:
0x0
Mode: standalone
Node count:
4
4.安裝cassandra
yum install dsc20 --nogpgcheck
#修改文件 /etc/cassandra/conf/cassandra.yaml
# The name of the cluster.
cluster_name:
‘midonet‘
# Addresses of hosts that are deemed contact points.
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds:
"midonet"
# Address to bind to and tell other Cassandra nodes to connect to.
listen_address:
10.211
.
55.5
# The address to bind the Thrift RPC service.
rpc_address: midonet
##修改/etc/init.d/cassandra
case
"$1"
in
start)
# Cassandra startup
echo -n
"Starting Cassandra: "
mkdir -p /var/run/cassandra
chown cassandra:cassandra /var/run/cassandra
su $CASSANDRA_OWNR -c
"$CASSANDRA_PROG -p $pid_file"
> $log_file
2
>&
1
retval=$?
###啟動cassandra
systemctl enable cassandra.service
systemctl start cassandra.service
##驗證
nodetool -host
127.0
.
0.1
status
Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns (effective) Host ID Rack
UN
10.211
.
55.5
113.82
KB
256
100.0
% 748d0d83-84ea-4b1a-b7a0-3c4f8c3270cd rack1
6.MidoNet API安裝
yum install midonet-api -y
#修改/usr/share/midonet-api/WEB-INF/web.xml
<context-param>
<param-name>rest_api-base_uri</param-name>
<param-value>http:
//midonet:8080/midonet-api</param-value>
</context-param>
<context-param>
<param-name>keystone-service_host</param-name>
<param-value>midonet</param-value>
</context-param>
<context-param>
<param-name>keystone-admin_token</param-name>
<param-value>6faca30b15bec6ffb8f8</param-value>
</context-param>
<context-param>
<param-name>zookeeper-zookeeper_hosts</param-name>
<!-- comma separated list of Zookeeper nodes(host:port) -->
<param-value>midonet:
2181
</param-value>
</context-param>
<context-param>
<param-name>midocluster-properties_file</param-name>
<!--
default
for
ubuntu systems with tomcat7 -->
<param-value>/var/lib/tomcat/webapps/host_uuid.properties</param-value>
</context-param>
##安裝tomcat
yum install tomcat -y --nogpgcheck
##修改/etc/tomcat/server.xml
<Connector port=
"8080"
protocol=
"HTTP/1.1"
connectionTimeout=
"20000"
URIEncoding=
"UTF-8"
redirectPort=
"8443"
maxHttpHeaderSize=
"65536"
/>
##創建/etc/tomcat/Catalina/localhost/midonet-api.xml
<Context
path=
"/midonet-api"
docBase=
"/usr/share/midonet-api"
antiResourceLocking=
"false"
privileged=
"true"
/>
##啟動tomcat
systemctl enable tomcat.service
systemctl start tomcat.service
7.MidoNet CLI
yum install python-midonetclient -y
##創建文件 ~/.midonetrc
[cli]
api_url = http:
//midonet:8080/midonet-api
username = admin
password = admin123456
project_id = admin
8.Midolman
yum install midolman -y
##修改/etc/midolman/midolman.conf
[zookeeper]
zookeeper_hosts = midonet:
2181
##
cat << EOF | mn-conf set -t
default
zookeeper {
zookeeper_hosts =
"midonet:2181"
}
cassandra {
servers =
"midonet"
}
EOF
##
echo
"cassandra.replication_factor : 1"
| mn-conf set -t
default
# 修改midolman.service 文件增加文件描述符數量
sed -i
‘/\[Service\]/a\LimitNOFILE=60000‘
/usr/lib/systemd/system/midolman.service
# 啟動服務
systemctl start midolman
##啟動midonet-cli
[root
@midonet
~]# midonet-cli
midonet>
###初始化網絡
neutron net-create ext-net --router:external
MidoNet 安裝(Kilo RDO)(最老版)