文章目录
  1. 1. PaaS(双节点)基础架设
    1. 1.1. 预备工作
      1. 1.1.0.1. 硬件准备
  2. 1.2. 系统安装CentOS
  3. 1.3. 配置网络
  4. 1.4. CentOS基本配置
  5. 1.5. 配置本地源
  6. 1.6. 基本服务安装
  7. 1.7. 修改脚本
  8. 1.8. 安装服务
    1. 1.8.1. controller上安装
  9. 1.9. 双节点均要安装
  10. 1.10. 云服务网络配置
  11. 1.11. 注意事项

航母战斗群

2016-4-9 周六;


PaaS(双节点)基础架设

预备工作

硬件准备

ThinkServer-RD630

  • 服务器ThinkServer-RD630(X2)
    controller节点(左一)

    Intel(R) Xeon(R) CPU E5-2609 2.40GHz

    8G内存
    CentOS release 6.5(Final) X86_64 选择Minimal最小化安装

compute节点(右一)

Intel(R) Xeon(R) CPU E5-2609 2.40GHz

24G内存

CentOS release 6.5(Final) X86_64 选择Minimal最小化安装


compute节点(右一)

  • H3C交换机
    交换机

    型号:H3C S5120-28C-EI


  • 接线工作:
    交换机接线图

eth0为外网,eth1设为外网;

V1-V12为内网,与物理网卡标记2(eth1)相连;

V13-24为外网,与物理网卡标记1(eth0)相连


系统安装CentOS

+操作系统均选择Minimal

  • controller无需分区使用整个硬盘
  • compute需要预留2个空分区

    预留2个空分区用来存储cinder、swift

compute分区

  • PC网卡配置

PC网卡配置

把其他不相关网卡禁用,否则干扰实验。


配置网络

  • Controller网卡

    eth0为外网 eth1为内网
    vi /etc/sysconfig/network-scripts/ifcfg-eth0

配置:

1
2
3
4
5
6
7
8
9
10
DEVICE=eth0
HWADDR=F8:0F:41:F4:B4:FA
TYPE=Ethernet
UUID=feee8a77-8ae0-4459-9f58-561ea355ebd7
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.100
NETMASK=255.255.255.0
GATEWAY=192.168.0.1

vi /etc/sysconfig/network-scripts/ifcfg-eth1

1
2
3
4
5
6
7
8
9
DEVICE=eth1
HWADDR=F8:0F:41:F4:B4:FB
TYPE=Ethernet
UUID=902fdce4-5102-438e-8554-44cf0be012ab
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.0.0.100
NETMASK=255.255.255.0

重启网卡服务:
service network restart

  • compute网卡
    vi /etc/sysconfig/network-scripts/ifcfg-eth0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    DEVICE=eth0
    HWADDR=F8:0F:41:F4:B4:F7
    TYPE=Ethernet
    UUID=fd6de9a3-4ae5-4f61-a709-fcebdb604bef
    ONBOOT=yes
    NM_CONTROLLED=no
    BOOTPROTO=static
    IPADDR=192.168.0.200
    GATEWAY=192.168.0.2
    NETMASK=255.255.255.0

vi /etc/sysconfig/network-scripts/ifcfg-eth1

1
2
3
4
5
6
7
8
9
DEVICE=eth1
HWADDR=F8:0F:41:F4:B4:F8
TYPE=Ethernet
UUID=782d0804-34ce-4d3d-ac4f-5c0451930f97
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=10.0.0.200
NETMASK=255.255.255.0

重启网卡服务:
service network restart


使用SecureFX将CentOS-6.5x86_64-bin.isoIaaS-v1.3.isoPaas-v1.3.iso脚本传入controller节点上

CentOS基本配置

1. hostname、增加内网地址

vi /etc/sysconfig/network

controller节点主机名改为controller

compute节点主机名改为compute

2. 添加内网地址:
compute、controller都要添加
vi /etc/hosts

1
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.100  controller 
10.0.0.200  compute

3. 关闭防火墙

controller、compute都要操作
service iptables stop
setenforce 0
修改selinux
vi /etc/selinux/config

SELINUX=permissive

1
2
3
[root@controller ~]# setenforce 0
[root@controller ~]# getenforce
Permissive

配置本地源

  1. 创建挂在文件夹

    1
    2
    [root@controller ~]# mkdir /opt/centos
    [root@controller ~]# mkdir /opt/icehouse
  2. 删除自带源

    1
    2
    3
    4
    5
    6
    7
    [root@controller ~]# rm -rfv /etc/yum.repos.d/*
    removed `/etc/yum.repos.d/CentOS-Base.repo'
    removed
    `/etc/yum.repos.d/CentOS-Debuginfo.repo'


    removed `/etc/yum.repos.d/CentOS-Media.repo'

    removed `/etc/yum.repos.d/CentOS-Vault.repo'
  3. 配置源本地:

[root@controller ~]#vi /etc/yum.repos.d/local.repo

1
2
3
4
5
6
7
8
9
10
[centos]
name=centos
baseurl=file:///opt/centos/
enabled=1
gpgcheck=0
[icehouse]
name=icehouse
baseurl=file:///opt/icehouse/iaas-repo/
enabled=1
gpgcheck=0

配置compute源

[root@compute yum.repos.d]# rm -rf /etc/yum.repos.d/*
[root@compute yum.repos.d]# vi /etc/yum.repos.d/local.repo

1
[centos]
name=centos
baseurl=ftp://10.0.0.100/centos/
gpgcheck=0
enabled=1
[icehouse]
name=icehouse
baseurl=ftp://10.0.0.100/icehouse/iaas-repo/
gpgcheck=0
enabled=1
  1. 挂载镜像

[root@controller ~]# mount -o loop CentOS-6.5-x86_64-bin.iso /opt/centos/
[root@controller ~]# mount -o loop XianDian-iaas-v1.2.iso /opt/icehouse/

  1. 更新controller源

[root@controller ~]# yum clean all

1
Loaded plugins: fastestmirror
Cleaning repos: centos icehouse
Cleaning up Everything

如果yum list失败,请检查controller节点上的vsftpd状态,并关闭防火墙。
如果防火墙关闭,vsftpd在运行,yum.repo.d文件配置没错提示

1
2
[Error 14]PYCURL ERROR 9-"server denied you to change to the given directory"
Trying other mirror.

setenfoce 0 将镜像所在节点的selinux零时设置为permissive

再次关闭防火墙

1
2
3
4
5
6
[root@controller ~]# service  iptables  stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@controller ~]# getenforce
Permissive

基本服务安装

yum list

安装必要组件
controller下

[root@controller ~]# yum install ntp vsftpd qpid-cpp-server openssh-clients

scp命令在openssh-clients这个包里

[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
在末尾添加

anon_root=/opt

[root@controller ~]# service vsftpd restart

1
Shutting down vsftpd: [  OK  ]
Starting vsftpd for vsftpd: [  OK  ]

再更新compute Yum源
在compute:安装ntpopenssh-clients

yum –y install ntp openssh-clients
配置ntp

[root@controller ~]# vi /etc/ntp.conf

server 127.127.1.0

fudge 127.127.1.0       stratum 10

[root@controller ~]# service ntpd restart

Shutting down ntpd: [ OK ]

Starting ntpd: [ OK ]

[root@controller ~]# chkconfig ntpd on
修改/etc/qpidd.cinf
[root@controller ~]# vi /etc/qpidd.conf

auth=no

重启qpidd

service qpidd restart

在compute下安装
[root@compute etc]# yum install -y ntp openssh-clients

comput下同步
ntpdate controller

(如果不能同步,请尝试关闭controller的防火墙)


修改脚本

进入脚本件夹内
controller:

chmod +x *.sh 提权

vi iaas-install-mysql.sh看IP是否要改

根据实际情况修改脚本IP
将脚本修该为实际内网IP,网卡设为外网

1
[root@controller scripts]# sed  -i  's,192.168.100.10,10.0.0.100,g'  *.sh  后面替换前面的,controller  内网IP;
[root@controller scripts]# sed  -i  's,192.168.100.20,10.0.0.200,g'  *.sh  后面替换前面, compute  内网IP;
sed  -i  ‘s,eth1,eth0,g’  *.sh             将外网网卡推上去,eth0为外网 eth1内网 (PS:脚本修改后应该是内网IP,外网网卡;)

修改后给compute传一份
在compute下装 yum –install openssh-clients

scp -r 脚本文件夹 compute:/root/


安装服务

controller上安装

  1. 安装Mysql
    ./iaas-install-mysql.sh

  1. 安装Keystone
    ./iaas-install-keystone.sh

    (漫长等待….)
    执行yum upgrade

写入环境变量 source /etc/keystone/admin-openrc.sh

如果没有执行会出现Expecting an auth URL via either –os-auth-url or env[OS_AUTH_URL]

仅当前窗口有效,执行后没有任何提示

检查

keystone user-list

keystone role-list

keystone service-list


  1. 安装Glance
    ./iaas-install-glance.sh

source /etc/keystone/admin-openrc.sh

检查镜像glance index

创建镜像:

1
glance image-create  --name   ‘centos6.5’  --disk-format  qcow2  --container-format bare  --is-public   true  --progress  <  /opt/icehouse/images/ce~.qcow2

创建镜像

再次检查镜像glance index


双节点均要安装

  1. 安装Nova

    先在controller上安装,comput也要安装

./iaas-install-nova-controller.sh

source /etc/keystone/admin-openrc.sh

安装完毕 检查 nova service-list

compute安装完成后controller中会增加nova-compute

检查防火墙是否关闭(stop)

/etc/init.d/qpidd status, 需要start

如果qpidd 是stop状态则需要重启 /etc/init.d/qpidd restart服务)

在controller执行nova service-list看服务状态


  1. 安装neutron

    先在controller上安装,comput也要安装

./iaas-install-neutron-controller.sh


先在compute执行yum upgrade



再安装
./iaas-install-neutron-compute.sh

在controller查看服务状态neutron agent-list


云服务网络配置

controller进行

  1. 创建网络

    查看 租户IDkeystone tenant-list

1
neutron net-create   --tenant-id  735bdf1e1af24844991e05822271e770  sharednet1  --shared  --provider:network_type   flat   --provider:physical_network  physnet1

注意tenant-id 添加server的ID

检查1.neutron agent-list

2.neutron net-list

3.neutron net-show 'sharednet1'

  1. 安装DashBoard
    yum install memcached python-memcached mod_wsgi openstack-dashboard

修改vi /etc/openstack-dashboard/local_settings 如图:

dashboard配置文件修改1

修改为controller内网的IP

去掉CACHES注释并提至定格(Python语法),如图:

dashboard配置文件修改该2

修改OPENSTACK_HOST主机名,如图:

重启服务/etc/init.d/httpd restart
在网页上启动实例http://10.0.0.100/dashboard (contorller内网ip)
创建子网subnet1,网络地址与外网地址一致


注意事项

如果关闭服务器,在开启建议重启服务流程

  1. source /etc/keystone/admin-openrc.sh

    关掉浏览器的dashboard每次都要重新souce一下

  2. service iptables stop coontroller&&compue都要
  3. service httpd restart
  4. neutron agent-list

    查看还有那些服务没开启,有XX字样表示该服务宕掉了,应该# /etc/init.d/neutron-?? restart即可

其他错误1

1
2
[15:30:03][root@controller ~]# neutron agent-list
[15:30:04]Connection to neutron failed: Maximum attempts reached

最后解决方法:重启controller节点neutron服务:

service neutron-server restart

可以通过/var/log/neutron/下的日志查看具体原因

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[15:31:53][root@controller ~]# tail /var/log/neutron/server.log 
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/strategies.py", line 80, in connect
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron return dialect.connect(*cargs, **cparams)
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron File "/usr/lib64/python2.6/site-packages/sqlalchemy/engine/default.py", line 283, in connect
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron return self.dbapi.connect(*cargs, **cparams)
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron File "/usr/lib64/python2.6/site-packages/MySQLdb/__init__.py", line 81, in Connect
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron return Connection(*args, **kwargs)
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron File "/usr/lib64/python2.6/site-packages/MySQLdb/connections.py", line 187, in __init__
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron super(Connection, self).__init__(*args, **kwargs2)
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron OperationalError: (OperationalError) (2003, "Can't connect to MySQL server on 'controller' (111)") None None
[15:31:53]2016-05-11 15:25:30.531 1877 TRACE neutron




[15:32:34][root@controller ~]# tail /var/log/neutron/metadata-agent.log
[15:32:34]2016-05-11 10:44:06.160 4930 TRACE neutron.agent.metadata.agent File "/usr/lib/python2.6/site-packages/neutron/openstack/common/rpc/proxy.py", line 129, in call
[15:32:34]2016-05-11 10:44:06.160 4930 TRACE neutron.agent.metadata.agent exc.info, real_topic, msg.get('method'))
[15:32:34]2016-05-11 10:44:06.160 4930 TRACE neutron.agent.metadata.agent Timeout: Timeout while waiting on RPC response - topic: "q-plugin", RPC method: "report_state" info: "<unknown>"
[15:32:34]2016-05-11 10:44:06.160 4930 TRACE neutron.agent.metadata.agent
[15:32:34]2016-05-11 10:44:06.162 4930 WARNING neutron.openstack.common.loopingcall [req-78bad648-1c92-4941-b0be-e976b95ae2ad None] task run outlasted interval by 30.070491 sec
[15:32:34]2016-05-11 11:27:05.614 18645 INFO neutron.common.config [-] Logging enabled!
[15:32:34]2016-05-11 11:27:05.802 18645 INFO eventlet.wsgi.server [req-458fe079-e01c-476d-bff0-c8ca398b7164 None] (18645) wsgi starting up on http:///:v/
[15:32:34]
[15:32:34]2016-05-11 11:27:05.818 18645 INFO neutron.openstack.common.rpc.impl_qpid [req-458fe079-e01c-476d-bff0-c8ca398b7164 None] Connected to AMQP server on controller:5672
[15:32:34]2016-05-11 11:27:05.830 18645 INFO neutron.openstack.common.rpc.impl_qpid [req-458fe079-e01c-476d-bff0-c8ca398b7164 None] Connected to AMQP server on controller:5672

  • mysql无法启动
    请尝试安全启动mysql

    mysqld_safe

    直接执行该命令即可

文章目录
  1. 1. PaaS(双节点)基础架设
    1. 1.1. 预备工作
      1. 1.1.0.1. 硬件准备
  2. 1.2. 系统安装CentOS
  3. 1.3. 配置网络
  4. 1.4. CentOS基本配置
  5. 1.5. 配置本地源
  6. 1.6. 基本服务安装
  7. 1.7. 修改脚本
  8. 1.8. 安装服务
    1. 1.8.1. controller上安装
  9. 1.9. 双节点均要安装
  10. 1.10. 云服务网络配置
  11. 1.11. 注意事项