有了之前组件(keystone、glance、nova、neutron)的安装后,那么就可以在命令行创建并启动instance了

照着官网来安装openstack pike之environment设置

照着官网来安装openstack pike之keystone安装

照着官网来安装openstack pike之glance安装

照着官网来安装openstack pike之nova安装

照着官网来安装openstack pike之neutron安装

创建并启动实例需要进行如下操作:

1、创建一个虚拟网络(使用的是网络选项1:provider networks)
  Create virtual networks for the networking option that you chose when configuring Neutron. If you chose option 1, create only the provider network. If you chose option 2, create the provider and self-service networks.
# source admin-openrc
Create the network:
# openstack network create  --share --external --provider-physical-network provider --provider-network-type flat provider

  The --share option allows all projects to use the virtual network.

  The --external option defines the virtual network to be external. If you wish to create an internal network, you can use --internal instead. Default value is internal.
  The --provider-physical-network provider and --provider-network-type flat options connect the flat virtual network to the flat (native/untagged) physical network on the eth1 interface on the host using information from the following files:

由于此次搭建的环境的本地网卡设备名

所以这里配置将eth1改为ens33

Create a subnet on the network:
# openstack subnet create --network provider --allocation-pool start=192.168.101.100,end=192.168.101.200 --dns-nameserver 192.168.101.2 --gateway 192.168.101.2 --subnet-range 192.168.101.0/ provider

Create m1.nano flavor:

# openstack flavor create --id  --vcpus  --ram  --disk  m1.nano

Generate a key pair
  Most cloud images support public key authentication rather than conventional password authentication. Before launching an instance, you must add a public key to the Compute service.
Source the demo project credentials:
# source demo-openrc
Generate a key pair and add a public key:
# ssh-keygen -q -N ""
# openstack keypair create --public-key ~/.ssh/id_rsa.pub mykey

Verify addition of the key pair:
# openstack keypair list

Add security group rules
  By default, the default security group applies to all instances and includes firewall rules that deny remote access to instances. For Linux images such as CirrOS, we recommend allowing at least ICMP (ping) and secure shell (SSH).
Add rules to the default security group:
Permit ICMP (ping):
# openstack security group rule create --proto icmp default

Permit secure shell (SSH) access:
# openstack security group rule create --proto tcp --dst-port  default

Launch an instance
  If you chose networking option 1, you can only launch an instance on the provider network. If you chose networking option 2, you can launch an instance on the provider network and the self-service network.
  启动实例之前需要指定the flavor, image name, network, security group, key, and instance name.
On the controller node, source the demo credentials to gain access to user-only CLI commands:
# source demo-openrc
A flavor specifies a virtual resource allocation profile which includes processor, memory, and storage.
List available flavors:
# openstack flavor list

List available images:
# openstack image list

List available networks:
# openstack network list

由于选择的网络为provider networks所以这里显示为上面,如果选择的option 2则为:

List available security groups:
# openstack security group list

现在启动一个实例:
Launch the instance:
Replace PROVIDER_NET_ID with the ID of the provider provider network.
# openstack server create --flavor m1.nano --image cirros --nic net-id=PROVIDER_NET_ID --security-group default --key-name mykey provider-instance
If you chose option 1 and your environment contains only one network, you can omit the --nic option because OpenStack automatically chooses the only network available.
将上面的PROVIDER_NET_ID改为上面的7ccde909-94fa-4315-81e6-aa2652166c5b
# openstack server create --flavor m1.nano --image cirros --nic net-id=7ccde909-94fa--81e6-aa2652166c5b --security-group default --key-name mykey provider-instance
最后面为实例名称,可以随便命名

Check the status of your instance:

# openstack server list

The status changes from BUILD to ACTIVE when the build process successfully completes.
可以看出已经有了ip

Access the instance using the virtual console
  Obtain a Virtual Network Computing (VNC) session URL for your instance and access it from a web browser:
# openstack console url show provider-instance(后面是实例名称)

现在进行浏览器访问:

一直在grub这里卡住了,解决办法:

将计算节点的的配置文件/etc/nova/nova.conf做如下修改:
[libvirt]
virt_type = qemu
cpu_mode = none
重启服务:
# systemctl restart libvirtd.service openstack-nova-compute.service
控制节点重启nova服务:
# systemctl status openstack-nova-api.service openstack-nova-consoleauth.service openstack-nova-scheduler.service openstack-nova-conductor.service openstack-nova-novncproxy.service  
然后在控制节点重新进行创建一个虚拟机:
# source demo-openrc
# openstack server create --flavor m1.nano --image cirros001 --nic net-id=7ccde909-94fa--81e6-aa2652166c5b --security-group default --key-name mykey instance002
# openstack server list
# openstack console url show instance002

计算节点查看虚拟机信息:

这里的虚拟机id和控制节点上面的openstack server list显示的虚拟机id一致

各部分日志:
grep 'ERROR' /var/log/nova/*
grep 'ERROR' /var/log/neutron/*
grep 'ERROR' /var/log/glance/*
grep 'ERROR' /var/log/keystone/*

查看节点instance:后面又创建了虚拟机

提示:在openstack环境下,所有计算节点主机的桥接网卡名称都一样。
对应三个虚拟机:

[root@node2 instances]# cd --4f81-b72c-8de42872675e/
[root@node2 --4f81-b72c-8de42872675e]# ll
总用量
-rw------- root root 10月 : console.log
-rw-r--r-- qemu qemu 10月 : disk
-rw-r--r-- nova nova 10月 : disk.info
  • console.log   控制台日志
  • disk               虚拟磁盘
  • disk.info        虚拟磁盘信息

上图中_base下面的 是镜像(上传的两个镜像)

[root@node2 --4f81-b72c-8de42872675e]# ls -lh
总用量 2.7M
-rw------- root root 38K 10月 : console.log
-rw-r--r-- qemu qemu 2.7M 10月 : disk
云主机metadata使用以及原理(在控制节点上查看)

上面显示的结果是一个namespace(命名空间)
然后在namespace中执行ip:
ip netns exec qdhcp-7ccde909-94fa--81e6-aa2652166c5b ip ad li

可以在域名空间执行一些命令

可以看出来多了几个ip

  • 云主机如何从dhcp获取这些信息?
根据etc/neutron/dhcp_agent.ini配置文件enable_isolated_metadata = true 实现
同时我们可以查看到namespace上启动80端口,用于云主机访问metadata,获取信息

可以看见在namespace中启动了80和53端口

照着官网来安装openstack pike之创建并启动instance的更多相关文章

  1. 照着官网来安装openstack pike之environment设置

    安装openstack前的准备环境: 两个centos7系统的环境:192.168.101.10 node1,192.168.101.11 node2 控制节点node1,计算节点node2 1.统一 ...

  2. 照着官网来安装openstack pike之neutron安装

    neutron组件安装分为控制节点和计算节点,还是先从控制节点安装 1.前提条件,数据库为nova创建库和账户密码来连接数据库 # mysql -u root -p MariaDB [(none)]& ...

  3. 照着官网来安装openstack pike之keystone安装

    openstack基础环境安装完成后,现在开启安装keystone服务(在控制节点上执行下面所有操作) 1.为keystone创建数据库 mysql -u root -p MariaDB [(none ...

  4. 照着官网来安装openstack pike之安装dashboard

    上文提到了利用命令行下使用openstack的命令来创建虚拟机,这里选择安装dashboard来安装基于web界面的openstack平台 利用dashboard界面来创建虚拟机 dashboard这 ...

  5. 照着官网来安装openstack pike之nova安装

    nova组件安装分为控制节点和计算节点,还是先从控制节点安装 1.前提条件,数据库为nova创建库和账户密码来连接数据库 # mysql -u root -p MariaDB [(none)]> ...

  6. 照着官网来安装openstack pike之glance安装

    镜像服务image service(glance)的安装还是在控制节点上进行: 1.前提条件,数据库为glance创建库和账户密码来连接数据库 # mysql -u root -p MariaDB [ ...

  7. go语言,golang学习笔记1 官网下载安装,中文社区,开发工具LiteIDE

    go语言,golang学习笔记1 官网下载安装,中文社区,开发工具LiteIDE Go语言是谷歌2009发布的专门针对多处理器系统应用程序的编程进行了优化,使用Go编译的程序可以媲美C或C++代码的速 ...

  8. PyCharm 2017 官网 下载 安装 设置 配置 (主题 字体 字号) 使用 入门 教程

    一.安装 Python 3.6 首先,要安装好 Python 3.6.如果你还没有安装,可以参考咪博士之前的教程 Python 3.6.3 官网 下载 安装 测试 入门教程 (windows) 二.官 ...

  9. Centos 7 官网下载安装mysql server 5.6

    Centos 7 官网下载安装 mysql server # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rp ...

随机推荐

  1. 【BZOJ2037】[Sdoi2008]Sue的小球 区间DP+费用提前

    [BZOJ2037][Sdoi2008]Sue的小球 Description Sue和Sandy最近迷上了一个电脑游戏,这个游戏的故事发在美丽神秘并且充满刺激的大海上,Sue有一支轻便小巧的小船.然而 ...

  2. 【BZOJ3881】[Coci2015]Divljak fail树+树链的并

    [BZOJ3881][Coci2015]Divljak Description Alice有n个字符串S_1,S_2...S_n,Bob有一个字符串集合T,一开始集合是空的. 接下来会发生q个操作,操 ...

  3. 第八周课上测试ch03

    测试-1-ch03 任务详情 通过输入gcc -S -o main.s main.c,将下面c程序"week04学号.c"编译成汇编代码 int g(int x){ return ...

  4. ArcGIS Data Store 初体验

    1. 什么是ArcGIS Data Store? ArcGIS Data Store 是10.3新推出的一个组件,从官方对其定位来说,该组件是用来优化发布托管服务到portal for ArcGIS的 ...

  5. Django 框架之 Models

    1. 数据库配置 Django默认支持sqlite, mysql, oracle, postgresql 数据库: Django默认使用sqlite数据库,引擎名称:django.db.backend ...

  6. 完全用nosql轻松打造千万级数据量的微博系统

    其实微博是一个结构相对简单,但数据量却是很庞大的一种产品.标题所说的是千万级数据量也并不是一千万条微博信息而已,而是千万级订阅关系之间发布.在看 我这篇文章之前,大多数人都看过sina的杨卫华大牛的微 ...

  7. MySQL优化(三):优化数据库对象

    二.优化数据库对象 1.优化表的数据类型 应用设计的时候需要考虑字段的长度留有一定的冗余,但不推荐很多字段都留有大量的冗余,这样既浪费磁盘空间,也在应用操作时浪费物理内存. 在MySQL中,可以使用函 ...

  8. 一次因为文件名开头包含空格而导致FTP文件一直无法下载的悲剧!

    最近负责公司研究新的多渠道打包方案,之前的打包方案太慢了,因此采用了美团的Android Signature V2 Scheme签名下的新一代渠道包打包神器 方案进行了多渠道打包.但是由于马虎,在配置 ...

  9. Linux进入-adsdfsd目录

    Linux进入-adsdfsd目录 如果某个目录名称是短线(短横线)开头的 要想在命令行中进入目录,使用如下命令: cd -- -adsdfsd 延伸: 其他非寻常操作: http://www.cnb ...

  10. 15.遇到window leaked的解决方法

    遇到这个可能是android:configChanges没有配置好 可以试试配置为这个 mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navig ...