openstack Juno系列之控制节点搭建
controller控制节点搭建安装keystone-------------所有主机hosts:取消其中127.0.0.110.0.0.11controller10.0.0.21neutron10.0.0.31computeto configure prerequisites:apt-get install python-software-propertiesadd-apt-repository cloud-archive:junoapt-get update && apt-get dist-upgrade安装数据库apt-get install mariadb-server python-mysqldbvi /etc/mysql/my.cnfbind-address = 10.0.0.11default-storage-engine = innodbinnodb_file_per_tablecollation-server = utf8_general_ciinit-connect = 'SET NAMES utf8'character-set-server = utf8重启服务service mysql restart 初始化数据库mysql_secure_installation MQ服务安装:apt-get install rabbitmq-serverrabbitmqctl change_password guest RABBIT_PASS (可以不设置保持默认) install and configureIdentity service on the controller node:#mysql -u root -p CREATE DATABASE keystone; GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'localhost' \IDENTIFIED BY 'KEYSTONE_DBPASS';GRANT ALL PRIVILEGES ON keystone.* TO 'keystone'@'%' \IDENTIFIED BY 'KEYSTONE_DBPASS';生成token keys:openssl rand -hex 10 安装Keystone :apt-get install keystone python-keystoneclientvi /etc/keystone/keystone.conf admin_token = ADMIN_TOKEN写上前面生成的token:verbose = Trueconnection = mysql://keystone:KEYSTONE_DBPASS@controller/keystoneprovider = keystone.token.providers.uuid.Providerdriver = keystone.token.persistence.backends.sql.Token同步数据库su -s /bin/sh -c "keystone-manage db_sync" keystone重启服务service keystone restart删除默认数据库rm -f /var/lib/keystone/keystone.db定时清理过期令牌(crontab -l -u keystone 2>&1 | grep -q token_flush) || \echo '@hourly /usr/bin/keystone-manage token_flush >/var/log/keystone/keystone-tokenflush.log 2>&1' \>> /var/spool/cron/crontabs/keystone 生成一定的环境变量:vi source.shexport OS_SERVICE_TOKEN=ADMIN_TOKENexport OS_SERVICE_ENDPOINT=http://controller:35357/v2.0 创建租户、角色keystone tenant-create --name admin --description "Admin Tenant"keystone user-create --name admin --pass ADMIN_PASS --email EMAIL_ADDRESSkeystone role-create --name adminkeystone user-role-add --tenant admin --user admin --role adminkeystone role-create --name _member_keystone user-role-add --tenant admin --user admin --role _member_keystone tenant-create --name demo --description "Demo Tenant"keystone user-create --name demo --pass DEMO_PASS --email EMAIL_ADDRESSkeystone user-role-add --tenant demo --user demo --role _member_keystone tenant-create --name service --description "Service Tenant" To create the service entity and API endpoint:keystone service-create --name keystone --type identity \--description "OpenStack Identity" keystone endpoint-create \--service-id $(keystone service-list | awk '/ identity / {print $2}') \--publicurl http://controller:5000/v2.0 \--internalurl http://controller:5000/v2.0 \--adminurl http://controller:35357/v2.0 \--region regionOne keystone配置租户管理员unset OS_SERVICE_TOKEN OS_SERVICE_ENDPOINTkeystone --os-tenant-name admin --os-username admin --os-password ADMIN_PASS \--os-auth-url http://controller:35357/v2.0 token-getkeystone --os-tenant-name admin --os-username admin --os-password ADMIN_PASS \--os-auth-url http://controller:35357/v2.0 tenant-listkeystone --os-tenant-name admin --os-username admin --os-password ADMIN_PASS \--os-auth-url http://controller:35357/v2.0 user-listkeystone --os-tenant-name admin --os-username admin --os-password ADMIN_PASS \--os-auth-url http://controller:35357/v2.0 role-listkeystone --os-tenant-name demo --os-username demo --os-password DEMO_PASS \--os-auth-url http://controller:35357/v2.0 token-getkeystone --os-tenant-name demo --os-username demo --os-password DEMO_PASS \--os-auth-url http://controller:35357/v2.0 user-listYou are not authorized to perform the requested action, admin_required. (HTTP 403) vi admin-openrc.shexport OS_TENANT_NAME=adminexport OS_USERNAME=adminexport OS_PASSWORD=ADMIN_PASSexport OS_AUTH_URL=http://controller:35357/v2.0 vi demo-openrc.shexport OS_TENANT_NAME=demoexport OS_USERNAME=demoexport OS_PASSWORD=DEMO_PASSexport OS_AUTH_URL=http://controller:5000/v2.0source admin-openrc.sh-------------------安装nova-controller-------------------创建数据库CREATE DATABASE nova;GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'localhost' \IDENTIFIED BY 'NOVA_DBPASS';GRANT ALL PRIVILEGES ON nova.* TO 'nova'@'%' \IDENTIFIED BY 'NOVA_DBPASS';注册nova服务用户source admin-openrc.shkeystone user-create --name nova --pass NOVA_PASSkeystone user-role-add --user nova --tenant service --role adminkeystone service-create --name nova --type compute \--description "OpenStack Compute"keystone endpoint-create \--service-id $(keystone service-list | awk '/ compute / {print $2}') \--publicurl http://controller:8774/v2/%\(tenant_id\)s \--internalurl http://controller:8774/v2/%\(tenant_id\)s \--adminurl http://controller:8774/v2/%\(tenant_id\)s \--region regionOne安装nova controller服务apt-get install nova-api nova-cert nova-conductor nova-consoleauth \nova-novncproxy nova-scheduler python-novaclient编辑配置文件vi /etc/nova/nova.conf connection = mysql://nova:NOVA_DBPASS@controller/nova rpc_backend = rabbitrabbit_host = controllerrabbit_password = RABBIT_PASS verbose = Trueauth_strategy = keystonemy_ip = 10.0.0.11(controller ip) vncserver_listen = 10.0.0.11vncserver_proxyclient_address = 10.0.0.11 auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = novaadmin_password = NOVA_PASS host = controller同步数据库su -s /bin/sh -c "nova-manage db sync" nova重启服务service nova-api restartservice nova-cert restartservice nova-consoleauth restartservice nova-scheduler restartservice nova-conductor restartservice nova-novncproxy restart脚本:for i in api cert consoleauth scheduler conductor novncproxy;do service nova-$i restart; done删除默认数据库rm -f /var/lib/nova/nova.sqlite------------------neutron-server--------------------在控制节点上创建数据库:mysql -u root -pCREATE 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';执行变量注册neutron用户source admin-openrc.shkeystone user-create --name neutron --pass NEUTRON_PASSkeystone user-role-add --user neutron --tenant service --role adminkeystone service-create --name neutron --type network \--description "OpenStack Networking"keystone endpoint-create \--service-id $(keystone service-list | awk '/ network / {print $2}') \--publicurl http://controller:9696 \--adminurl http://controller:9696 \--internalurl http://controller:9696 \--region regionOne安装neutron-server服务apt-get install neutron-server neutron-plugin-ml2 python-neutronclient编辑配置文件vi/etc/neutron/neutron.confverbose = Truerpc_backend = rabbitrabbit_host = controllerrabbit_password = RABBIT_PASS auth_strategy = keystone core_plugin = ml2service_plugins = routerallow_overlapping_ips = True notify_nova_on_port_status_changes = Truenotify_nova_on_port_data_changes = Truenova_url = http://controller:8774/v2nova_admin_auth_url = http://controller:35357/v2.0nova_region_name = regionOnenova_admin_username = novanova_admin_tenant_id = SERVICE_TENANT_ID 此ID下面命令产生nova_admin_password = NOVA_PASS 执行脚本查看租户IDsource admin-openrc.shkeystone tenant-get service 继续编辑配置文件auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = neutronadmin_password = NEUTRON_PASS connection = mysql://neutron:NEUTRON_DBPASS@controller/neutron编辑ml2配置文件vi /etc/neutron/plugins/ml2/ml2_conf.initype_drivers = flat,gretenant_network_types = gremechanism_drivers = openvswitch tunnel_id_ranges = 1:1000 enable_security_group = Trueenable_ipset = Truefirewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver编辑nova配置文件vi /etc/nova/nova.confnetwork_api_class = nova.network.neutronv2.api.APIsecurity_group_api = neutronlinuxnet_interface_driver = nova.network.linux_net.LinuxOVSInterfaceDriverfirewall_driver = nova.virt.firewall.NoopFirewallDriver url = http://controller:9696auth_strategy = keystoneadmin_auth_url = http://controller:35357/v2.0admin_tenant_name = serviceadmin_username = neutronadmin_password = NEUTRON_PASS同步数据库su -s /bin/sh -c "neutron-db-manage --config-file /etc/neutron/neutron.conf \--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade juno" neutron重启服务service nova-api restartservice nova-scheduler restartservice nova-conductor restartservice neutron-server restart验证neutron是否搭建成功source admin-openrc.shneutron ext-list在控制节点mysql上创建glance数据库CREATE DATABASE glance;GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' \IDENTIFIED BY 'GLANCE_DBPASS';GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' \IDENTIFIED BY 'GLANCE_DBPASS';在keystone节点注册glance用户source admin-openrc.shkeystone user-create --name glance --pass GLANCE_PASSkeystone user-role-add --user glance --tenant service --role adminkeystone service-create --name glance --type image \--description "OpenStack Image Service" keystone endpoint-create \--service-id $(keystone service-list | awk '/ image / {print $2}') \--publicurl http://controller:9292 \--internalurl http://controller:9292 \--adminurl http://controller:9292 \--region regionOne安装并且配置glance服务apt-get install glance python-glanceclientvi /etc/glance/glance-api.conf connection = mysql://glance:GLANCE_DBPASS@controller/glance auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = glanceadmin_password = GLANCE_PASS flavor = keystone default_store = filefilesystem_store_datadir = /var/lib/glance/images/ verbose = True 编辑配置文件vi/etc/glance/glance-registry.confconnection = mysql://glance:GLANCE_DBPASS@controller/glance auth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = glanceadmin_password = GLANCE_PASS flavor = keystone verbose = True 同步数据库:su -s /bin/sh -c "glance-manage db_sync" glance重启服务service glance-registry restartservice glance-api restart删除默认数据库rm -f /var/lib/glance/glance.sqlite 下载镜像mkdir /tmp/imagescd /tmp/imageswget http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.imgsource admin-openrc.shglance image-create --name "cirros-0.3.3-x86_64" --file cirros-0.3.3-x86_64-disk.img \--disk-format qcow2 --container-format bare --is-public True --progress验证glance是否搭建成功glance image-list
页:
[1]