Chinaunix首页 | 论坛 | 博客
  • 博客访问: 845727
  • 博文数量: 343
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 3600
  • 用 户 组: 普通用户
  • 注册时间: 2015-06-16 23:53
文章分类

全部博文(343)

文章存档

2018年(67)

2017年(145)

2016年(131)

我的朋友

分类: 云计算

2016-12-09 06:10:38

我们已经有了 Load Balance Pool “web servers”和 VIP,接下来需要往 Pool 里添加 member 并学习如何使用 cloud image。 先准备两个 instance: “Web1” 和 “Web2”。

使用 Ubuntu Cloud Image

由于 cirros 镜像不能运行 HTTP 服务,我们将使用 Ubuntu Cloud Image,下载地址为 http://uec-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img

 
与以前的 instance 不同,Web1 和 Web2 使用了命名为“cloud”的 Key Pair。 
这是因为 Ubuntu Cloud Image 默认用户 “ubuntu” 的密码是随机生成的,通过 Key Pair 访问是一个比较方便的方法。

下面是 Key Pair 的配置方法:

  1. 通过 ssh-keygen 生成 Key Pair。 
     
    其中 cloud.key.pub 是公钥,需要添加到 instance 的 ~/.ssh/authorized_keys 文件中。 
    cloud.key 是私钥,用于访问 instance。

  2. 将 Pair Key 导入 OpenStack 
    进入 Project -> Compute -> Access & Security 菜单,点击 Key Pairs 标签页的 “Import Key Pair” 按钮。 

    复制 cloud.key.pub 的内容。 
     
    粘贴到 Public Key 输入框中,给 Key Pair 命名为 “cloud”,并点击 “Import Key Pair”。 
     
    Key Pair “cloud” 成功导入。 

  3. 使用 Key Pair “cloud”。 
    launch instance 的时候,在 Access & Security 标签页中选择 Key Pair “cloud”。 
    OpenStack 会自动将公钥添加进 instance 的 ~/.ssh/authorized_keys 文件。 

  4. ssh instance。 
    用 -i cloud.key 指定私钥,并以 ubuntu 用户 ssh “Web1” 和 “Web2”。 
     
    无需密码直接登录 instance。 
    注:为了便于演示,这里我们是在 router 的 namespace 中执行 ssh,主要目的是网络可达。

“Web1” 和 “Web2” 准备就绪了,可以添加到 Pool 中了。 
在 Project -> Network -> Load Balancers 的 Members 标签页中 点击 “Add Member” 
按钮。

Pool 选择 “web servers”。 
Member(s) 中多选 “Web1” 和 “Web2”。 
Protocol Port 设置为 “80”。

点击 “Add”,member 添加成功。

Pool Member 有了,下一节我们将为 Pool 创建 Monitor,用于 Member 健康检查。

二维码+指纹.png

阅读(800) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~