`
haoningabc
  • 浏览: 1475076 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

M版本的openstack的例子(linuxbridge)

阅读更多
做两个节点控制节点和计算节点
mcontroller521  192.168.139.185
mcompute521  192.168.139.186

/etc/sysconfig/network-scripts/ifcfg-eth0
##############
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.139.185
NETMASK=255.255.240.0
GATEWAY=192.168.128.1
DNS1=114.114.114.114
##################
/etc/hosts
##############
192.168.139.186 mcompute521
192.168.139.185 mcontroller521
#############
yum remove PackageKit
yum install centos-release-openstack-mitaka -y
yum install https://repos.fedorapeople.org/repos/openstack/openstack-mitaka/rdo-release-mitaka-6.noarch.rpm -y
yum upgrade -y
yum install python-openstackclient openstack-selinux -y
vim /etc/selinux/config
systemctl stop firewalld
systemctl disable firewalld
systemctl stop NetworkManager
systemctl disable NetworkManager


yum install mariadb mariadb-server python2-PyMySQL -y
/etc/my.cnf.d/openstack.cnf
########################
[mysqld]
bind-address = 192.168.139.185
default-storage-engine = innodb
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8
#######################
systemctl enable mariadb.service
systemctl start mariadb.service
mysql_secure_installation


yum install rabbitmq-server -y
systemctl enable rabbitmq-server.service
systemctl start rabbitmq-server.service
rabbitmqctl add_user openstack haoning
rabbitmqctl set_permissions openstack ".*" ".*" ".*"

yum install memcached python-memcached -y
systemctl enable memcached.service
systemctl start memcached.service

mysql -u root -p
CREATE DATABASE keystone;
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%'  IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'mcontroller521'  IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'mcompute521'  IDENTIFIED BY 'haoning';


openssl rand -hex 10
276827888f4482e79226
yum install openstack-keystone httpd mod_wsgi -y
/etc/keystone/keystone.conf
###############
[DEFAULT]
admin_token = 276827888f4482e79226
[database]
connection = mysql+pymysql://keystone:haoning@mcontroller521/keystone
[token]
provider = fernet
###############
su -s /bin/sh -c "keystone-manage db_sync" keystone

/etc/httpd/conf/httpd.conf
#########################
ServerName mcontroller521
########################
/etc/httpd/conf.d/wsgi-keystone.conf
#####################
Listen 5000
Listen 35357

<VirtualHost *:5000>
    WSGIDaemonProcess keystone-public processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-public
    WSGIScriptAlias / /usr/bin/keystone-wsgi-public
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
    </Directory>
</VirtualHost>

<VirtualHost *:35357>
    WSGIDaemonProcess keystone-admin processes=5 threads=1 user=keystone group=keystone display-name=%{GROUP}
    WSGIProcessGroup keystone-admin
    WSGIScriptAlias / /usr/bin/keystone-wsgi-admin
    WSGIApplicationGroup %{GLOBAL}
    WSGIPassAuthorization On
    ErrorLogFormat "%{cu}t %M"
    ErrorLog /var/log/httpd/keystone-error.log
    CustomLog /var/log/httpd/keystone-access.log combined

    <Directory /usr/bin>
        Require all granted
    </Directory>
</VirtualHost>
###################
systemctl enable httpd.service
systemctl start httpd.service

export OS_TOKEN=276827888f4482e79226
export OS_URL=http://mcontroller521:35357/v3
export OS_IDENTITY_API_VERSION=3
openstack service create --name keystone --description "OpenStack Identity" identity
openstack endpoint create --region wuhan  identity public http://mcontroller521:5000/v3
openstack endpoint create --region wuhan  identity internal http://mcontroller521:5000/v3
openstack endpoint create --region wuhan  identity admin http://mcontroller521:35357/v3

openstack domain create --description "Default Domain" default
openstack project create --domain default --description "Admin Project" admin
openstack user create --domain default --password-prompt admin
openstack role create admin
openstack role add --project admin --user admin admin

openstack project create --domain default --description "Service Project" service
openstack project create --domain default --description "Demo Project" demo
openstack user create --domain default --password-prompt demo
openstack role create user
openstack role add --project demo --user demo user

openstack domain list
openstack project list
openstack user list
openstack role list


unset OS_TOKEN OS_URL
openstack --os-auth-url http://mcontroller521:35357/v3  --os-project-domain-name default --os-user-domain-name default  --os-project-name admin --os-username admin token issue
openstack --os-auth-url http://mcontroller521:5000/v3  --os-project-domain-name default --os-user-domain-name default  --os-project-name demo --os-username demo token issue

admin-openrc
###############
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=admin
export OS_USERNAME=admin
export OS_PASSWORD=haoning
export OS_AUTH_URL=http://mcontroller521:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
#################
demo-openrc
#################
export OS_PROJECT_DOMAIN_NAME=default
export OS_USER_DOMAIN_NAME=default
export OS_PROJECT_NAME=demo
export OS_USERNAME=demo
export OS_PASSWORD=haoning
export OS_AUTH_URL=http://mcontroller521:5000/v3
export OS_IDENTITY_API_VERSION=3
export OS_IMAGE_API_VERSION=2
#################

★★★★★★★安装glance
mysql -u root -p
CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'mcontroller521'  IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'mcompute521'  IDENTIFIED BY 'haoning';

openstack user create --domain default --password-prompt glance
openstack role add --project service --user glance admin

openstack service create --name glance --description "OpenStack Image" image
openstack endpoint create --region wuhan image public http://mcontroller521:9292
openstack endpoint create --region wuhan image internal http://mcontroller521:9292
openstack endpoint create --region wuhan image admin http://mcontroller521:9292

openstack endpoint list

yum install openstack-glance -y
/etc/glance/glance-api.conf
##################
[database]
connection = mysql+pymysql://glance:haoning@mcontroller521/glance
[keystone_authtoken]
auth_uri = http://mcontroller521:5000
auth_url = http://mcontroller521:35357
memcached_servers = mcontroller521:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = haoning
[paste_deploy]
flavor = keystone
[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
##################
/etc/glance/glance-registry.conf
############################
[database]
connection = mysql+pymysql://glance:haoning@mcontroller521/glance
[keystone_authtoken]
auth_uri = http://mcontroller521:5000
auth_url = http://mcontroller521:35357
memcached_servers = mcontroller521:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = haoning

[paste_deploy]
flavor = keystone
###########################

su -s /bin/sh -c "glance-manage db_sync" glance
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service

wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
openstack image create "cirros"  --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare  --public
openstack image list


★★★★★★★Install and configure controller node
mysql -u root -p
CREATE DATABASE nova_api;
CREATE DATABASE nova;
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'%' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'mcontroller521' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova_api.* TO 'nova'@'mcompute521' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'mcontroller521' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'mcompute521' IDENTIFIED BY 'haoning';

openstack user create --domain default --password-prompt nova
openstack role add --project service --user nova admin
openstack service create --name nova --description "OpenStack Compute" compute
openstack endpoint create --region wuhan compute public http://mcontroller521:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region wuhan compute internal http://mcontroller521:8774/v2.1/%\(tenant_id\)s
openstack endpoint create --region wuhan compute admin http://mcontroller521:8774/v2.1/%\(tenant_id\)s

yum install openstack-nova-api openstack-nova-conductor openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler -y
/etc/nova/nova.conf
#####################
[DEFAULT]
enabled_apis = osapi_compute,metadata
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.139.185
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[api_database]
connection = mysql+pymysql://nova:haoning@mcontroller521/nova_api
[database]
connection = mysql+pymysql://nova:haoning@mcontroller521/nova
[oslo_messaging_rabbit]
rabbit_host = mcontroller521
rabbit_userid = openstack
rabbit_password = haoning
[keystone_authtoken]
auth_uri = http://mcontroller521:5000
auth_url = http://mcontroller521:35357
memcached_servers = mcontroller521:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = nova
password = haoning
[vnc]
vncserver_listen = $my_ip
vncserver_proxyclient_address = $my_ip
[glance]
api_servers = http://mcontroller521:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
#####################

su -s /bin/sh -c "nova-manage api_db sync" nova
su -s /bin/sh -c "nova-manage db sync" nova
systemctl enable openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service
systemctl start openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service


★★★★★★★★Install and configure a compute node
yum install openstack-nova-compute -y
/etc/nova/nova.conf
################
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
my_ip = 192.168.139.186
use_neutron = True
firewall_driver = nova.virt.firewall.NoopFirewallDriver
[oslo_messaging_rabbit]
rabbit_host = mcontroller521
rabbit_userid = openstack
rabbit_password = haoning
[vnc]
enabled = True
vncserver_listen = 0.0.0.0
vncserver_proxyclient_address = $my_ip
novncproxy_base_url = http://mcontroller521:6080/vnc_auto.html
[glance]
api_servers = http://mcontroller521:9292
[oslo_concurrency]
lock_path = /var/lib/nova/tmp
[libvirt]
virt_type = qemu
##################

egrep -c '(vmx|svm)' /proc/cpuinfo

systemctl enable libvirtd.service openstack-nova-compute.service
systemctl start libvirtd.service openstack-nova-compute.service
openstack compute service list


neutron★★★★★★★★★★★★Install and configure controller node

mysql -u root -p
CREATE DATABASE neutron;
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'localhost' IDENTIFIED BY 'NEUTRON_DBPASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'%' IDENTIFIED BY 'NEUTRON_DBPASS';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'mcontroller521' IDENTIFIED BY 'haoning';
GRANT ALL PRIVILEGES ON neutron.* TO 'neutron'@'mcompute521' IDENTIFIED BY 'haoning';

openstack user create --domain default --password-prompt neutron
openstack role add --project service --user neutron admin
openstack service create --name neutron --description "OpenStack Networking" network
openstack endpoint create --region wuhan network public http://mcontroller521:9696
openstack endpoint create --region wuhan network internal http://mcontroller521:9696
openstack endpoint create --region wuhan network admin http://mcontroller521:9696

★★★★★★Networking Option 1: Provider networks
yum install openstack-neutron openstack-neutron-ml2 openstack-neutron-linuxbridge ebtables -y
/etc/neutron/neutron.conf
################
[DEFAULT]
core_plugin = ml2
service_plugins = router

allow_overlapping_ips = True

rpc_backend = rabbit
auth_strategy = keystone
notify_nova_on_port_status_changes = True
notify_nova_on_port_data_changes = True
[database]
connection = mysql+pymysql://neutron:haoning@mcontroller521/neutron
[oslo_messaging_rabbit]
rabbit_host = mcontroller521
rabbit_userid = openstack
rabbit_password = haoning
[keystone_authtoken]
auth_uri = http://mcontroller521:5000
auth_url = http://mcontroller521:35357
memcached_servers = mcontroller521:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = haoning
[nova]
auth_url = http://mcontroller521:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = nova
password = haoning
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
###################
/etc/neutron/plugins/ml2/ml2_conf.ini
##############
[ml2]
type_drivers = flat,vlan,vxlan
tenant_network_types = vxlan
mechanism_drivers = linuxbridge,l2population
extension_drivers = port_security
[ml2_type_flat]
flat_networks = provider
[ml2_type_vxlan]
vni_ranges = 1:1000
[securitygroup]
enable_ipset = True
###############################
/etc/neutron/plugins/ml2/linuxbridge_agent.ini
###########################
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = True
local_ip = 192.168.139.185
l2_population = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
############################
/etc/neutron/l3_agent.ini
##############################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
external_network_bridge =
##############################


/etc/neutron/dhcp_agent.ini
#########################
[DEFAULT]
interface_driver = neutron.agent.linux.interface.BridgeInterfaceDriver
dhcp_driver = neutron.agent.linux.dhcp.Dnsmasq
enable_isolated_metadata = True


/etc/neutron/metadata_agent.ini
###########################
[DEFAULT]
nova_metadata_ip = mcontroller521
metadata_proxy_shared_secret = haoning
###########################
/etc/nova/nova.conf
################################
[neutron]
url = http://mcontroller521:9696
auth_url = http://mcontroller521:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = neutron
password = haoning
service_metadata_proxy = True
metadata_proxy_shared_secret = haoning
#############################
ln -s /etc/neutron/plugins/ml2/ml2_conf.ini /etc/neutron/plugin.ini
su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf  --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head" neutron
systemctl restart openstack-nova-api.service

systemctl enable neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service
systemctl start neutron-server.service neutron-linuxbridge-agent.service neutron-dhcp-agent.service neutron-metadata-agent.service

systemctl enable neutron-l3-agent.service
systemctl start neutron-l3-agent.service

neutron★★★★★★Install and configure compute node

yum install openstack-neutron-linuxbridge ebtables ipset -y
/etc/neutron/neutron.conf
#####################
[DEFAULT]
rpc_backend = rabbit
auth_strategy = keystone
[oslo_messaging_rabbit]
rabbit_host = mcontroller521
rabbit_userid = openstack
rabbit_password = haoning
[keystone_authtoken]
auth_uri = http://mcontroller521:5000
auth_url = http://mcontroller521:35357
memcached_servers = mcontroller521:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = neutron
password = haoning
[oslo_concurrency]
lock_path = /var/lib/neutron/tmp
##################################################
/etc/neutron/plugins/ml2/linuxbridge_agent.ini
###########################
[linux_bridge]
physical_interface_mappings = provider:eth0
[vxlan]
enable_vxlan = True
local_ip = 192.168.139.186
l2_population = True
[securitygroup]
enable_security_group = True
firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver
#############################
/etc/nova/nova.conf
###################
[neutron]
url = http://mcontroller521:9696
auth_url = http://mcontroller521:35357
auth_type = password
project_domain_name = default
user_domain_name = default
region_name = wuhan
project_name = service
username = neutron
password = haoning
####################
systemctl restart openstack-nova-compute.service
systemctl enable neutron-linuxbridge-agent.service
systemctl start neutron-linuxbridge-agent.service

neutron ext-list
neutron agent-list

★★★★★★★建个vm
neutron net-create --shared --provider:physical_network provider  --provider:network_type flat provider
neutron subnet-create --name provider --allocation-pool start=192.168.139.220,end=192.168.139.225 --dns-nameserver 8.8.8.8 --gateway 192.168.128.1 provider 192.168.128.0/20

neutron net-create selfservice
neutron subnet-create --name selfservice --dns-nameserver 8.8.4.4 --gateway 172.16.1.1 selfservice 172.16.1.0/24

neutron net-update provider --router:external

neutron router-create router
neutron router-interface-add router selfservice
neutron router-gateway-set router provider

neutron port-list
neutron router-port-list router

openstack flavor create --id 0 --vcpus 1 --ram 64 --disk 1 m1.nano

ssh-keygen -q -N ""
openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey
openstack keypair list

openstack security list
openstack security group rule create --proto icmp default

openstack security group rule create --proto tcp --dst-port 22 default


openstack flavor list
openstack image list
openstack network list
openstack security group list

外网
#openstack server create --flavor m1.tiny --image cirros  --nic net-id=PROVIDER_NET_ID --security-group default  --key-name mykey provider-instance
openstack server list
openstack console url show provider-instance
ssh cirros@203.0.113.103

内网
neutron net-list  /  openstack network list
openstack server create --flavor m1.tiny --image cirros --nic net-id=a61423e7-4a5f-49d9-856f-1fdcb61c4418 --security-group default --key-name mykey selfservice-instance
openstack console url show selfservice-instance
nova list
ip netns exec qdhcp-a61423e7-4a5f-49d9-856f-1fdcb61c4418 ssh cirros@172.16.1.3


#openstack ip floating create provider
192.168.139.222
#openstack ip floating add 192.168.139.222  selfservice-instance
ssh cirros@192.168.139.222

nova list  / openstack server list


nova hypervisor-list
nova service-list
nova-manage cell_v2 discover_hosts
nova-manage cell_v2 list_cells
openstack endpoint list






























分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics