文章目录
  1. 1. 基本环境配置
  2. 2. 配置RHC
  3. 3. 其他RHC命令:

2016-5-12周四

全天工作

RHC

基本环境配置

node节点上添加paas平台的域名地址

一定要做这一步,不然后面会报错!!!
现在webconsole网页上设置指定主机名,如:broker
在 /etc/hosts添加PaaS平台的IP

1
2
3
4
[root@node ~]# vi /etc/hosts
192.168.200.124 broker.xdpaas.com #broker的IP
192.168.200.125 node
192.168.200.127 gitserver

配置RHC

  1. 安装Gem工具

    1
    [root@node ~]# yum -y install rubygems
  2. 安装RHC工具

  • paas光盘下的rhc目录文件拷贝到node上的/tmp/rhc

    mkdir /tmp/rhc

    cd /tmp/rhc

    [root@node rhc]# wget -r -nd ftp://192.168.200.10/paas/rhc/

    [root@node rhc]# gem install --local rhc-1.32.2.gem
    会有一次报错,重复执行该命令即可!

  • 配置RHC
    [root@node rhc]# rhc setup --server=broker.xdpaas.com

    注意要在Paas平台搭建完成后,才能进行RHC运维.

提示:

[root@node rhc]# rhc setup –server=broker.xdpaas.com

密码是paas平台的登入帐号:adminpass和密码:PasswOrd

1
2
3
4
5
6
7
8
9
OpenShift Client Tools (RHC) Setup Wizard

This wizard will help you upload your SSH keys, set your application namespace, and check that other programs like Git
are properly installed.

The server's certificate is self-signed, which means that a secure connection can't be established to
'broker.xdpaas.com'.

You may bypass this check, but any data you send to the server could be intercepted by others.

Connect without checking the certificate? (yes|no): yes

Login to broker.xdpaas.com: adminpass

Password: ********

1
2
3
OpenShift can create and store a token on disk which allows to you to access the server without using your password.
The key is stored in your home directory and should be kept secret. You can delete the key at any time by running 'rhc
logout'.

Generate a token now? (yes|no) yes

1
2
3
4
5
6
7
Generating an authorization token for this client ... lasts about 23 hours

Saving configuration to /root/.openshift/express.conf ... done

No SSH keys were found. We will generate a pair of keys for you.

Created: /root/.ssh/id_rsa.pub

Your public SSH key must be uploaded to the OpenShift server to access code. Upload now? (yes|no) yes

1
2
3
4
5
6
7
8
9
10
11
12
13

default (type: ssh-rsa)
-----------------------
Fingerprint: 6f:c5:f8:ac:37:82:97:bf:b9:c5:73:04:0a:a5:0d:2a

rhc (type: ssh-rsa)
-------------------
Fingerprint: 20:df:b2:00:77:ef:a7:1a:bc:79:35:58:72:24:d2:81

You can enter a name for your key, or leave it blank to use the default name. Using the same name as an existing key
will overwrite the old key.

Provide a name for this key: |adminpassgitserv| rhc

**创建python:**

[root@node rhc]# rhc app-create pythonapp python-2.6

提示错误

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
27
28
29
30
31
32
33
34
35
36
37
Creating application 'pythonapp' ... done


Waiting for your DNS name to be available ... retry # 1 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 2 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 3 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 4 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 5 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 6 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
retry # 7 - Waiting for DNS: pythonapp-xdpaas.xdpaas.com
failure
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: Your application was created successfully but had problems during
configuration. Below is a list of the issues and steps you can
take to complete the configuration of your application.

Application URL: http://pythonapp-xdpaas.xdpaas.com/

Issues:
1. We were unable to lookup your hostname (pythonapp-xdpaas.xdpaas.com) in a reasonable amount of time and can not
clone your application.

Steps to complete your configuration:
1. Clone your git repo
$ rhc git-clone pythonapp

If you continue to experience problems after completing these steps,
you can try destroying and recreating the application:

$ rhc app delete pythonapp --confirm

Please contact us if you are unable to successfully create your
application:

Support - https://www.openshift.com/support

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

解决方法:

  1. 删除错误主机的应用

    [root@node rhc]# rhc domain-delete xdpaas

    1
    2
    3
    4
    5
    Deleting domain 'xdpaas' ... Domain contains applications. Delete applications first or set force to true.
    [root@node rhc]# rhc app-delete pythonapp
    This is a non-reversible action! Your application code and data will be permanently deleted if you continue!

    Are you sure you want to delete the application 'pythonapp'? (yes|no): yes
  2. 删除错误的主机

    [root@node rhc]# rhc domain-delete xdpaas

    1
    Deleting domain 'xdpaas' ... Domain contains applications. Delete applications first or set force to true.
  3. 重新建立主机

    [root@node rhc]# rhc create-domain broker

    1
    2
    3
    Creating domain 'broker' ... done
    You may now create an application using the 'rhc create-app' command
    [root@node rhc]#
  4. 重新在正确的主机下,新建应用:

[root@node rhc]# rhc app-create pythonapp python-2.6

仍然会报错

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Application Options
-------------------
Domain: broker
Cartridges: python-2.6
Gear Size: default
Scaling: no

Creating application 'pythonapp' ... done


Waiting for your DNS name to be available ... retry # 1 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 2 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 3 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 4 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 5 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 6 - Waiting for DNS: pythonapp-broker.xdpaas.com
retry # 7 - Waiting for DNS: pythonapp-broker.xdpaas.com
failure
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
WARNING: Your application was created successfully but had problems during
configuration. Below is a list of the issues and steps you can
take to complete the configuration of your application.

Application URL: http://pythonapp-broker.xdpaas.com/

Issues:
1. We were unable to lookup your hostname (pythonapp-broker.xdpaas.com) in a reasonable amount of time and can not
clone your application.

Steps to complete your configuration:
1. Clone your git repo
$ rhc git-clone pythonapp

If you continue to experience problems after completing these steps,
you can try destroying and recreating the application:

$ rhc app delete pythonapp --confirm

Please contact us if you are unable to successfully create your
application:

Support - https://www.openshift.com/support

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  1. 查询应用状态

[root@node php]# rhc app-show pythonapp

如果遇到错误

1
2
3
Unable to connect to the server (getaddrinfo: Name or service not known (https://broker.xdpaas.com:443)). Check that
you have correctly specified your OpenShift server 'https://broker.xdpaas.com/broker/rest/api'.

请尝试在 vi /etc/hosts

1
192.168.200.124 broker.xdpaas.com  左边为broker的IP

其他RHC命令:

  1. 查询主机信息:

    [root@node rhc]# rhc domain-show

  2. 删除应用
    [root@node rhc]# rhc app-delete pythonapp #pythonapp是用用名称

  3. 删除主机
    [root@node rhc]# rhc domain-show

  4. rhc查看其他命令:

    1
    rhc      help   show

    查询rhc 的show相关命令;

  5. 停止app

    1
    rhc   app-stop   pythonapp
  6. 开启app

    1
    rhc   app-start  pythonapp
  7. 查看某个app状态

    1
    rhc  app-show   pythonapp
  8. rhc cartridge list

  9. 添加自定义应用,并添加mysql5.1
    # rhc app-create mysqldb diy-0.1 mysql-5.1

  10. 也可以先创建应用,在添加插件

# rhc app-create pythonapp python-2.7

# rhc cartridge add mysql-5.1 -a pythonapp

添加域名:

# rhc alias add pythonapp vivatakethat.com

文章目录
  1. 1. 基本环境配置
  2. 2. 配置RHC
  3. 3. 其他RHC命令: