MidoNet 安装(Kilo RDO)(最老版)
一、初始化(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