Quantcast
Channel: CodeSection,代码区,Linux操作系统:Ubuntu_Centos_Debian - CodeSec
Viewing all articles
Browse latest Browse all 11063

CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

$
0
0
1.配置 RHCS 集群的前提:

时间同步

名称解析,这里使用修改 /etc/hosts 文件

配置好 yum 源, CentOS 6 的默认的就行

关闭防火墙(或者开放集群所需通信端口),和 selinux

关闭 NetworkManager 服务

2. RHCS 所需要的主要软件包为 cman 和 rgmanager

cman: 是集群基础信息层,在 CentOS 6 中依赖 corosync

rgmanager: 是集群资源管理器, 类似于 pacemaker 的功能

luci: 提供了管理 rhcs 集群的 web 界面 , luci 管理集群主要是通过跟 ricci 通信来完成的。

ricci: 安装在集群的节点的接收来自 luci 管理请求的代理。

luci 跟 ricci 的关系就好像 ambari-server 跟 ambari-agent 一样。

3. 环境说明 : luci : 192.168.6.31 cent1.test.com ricci: 192.168.6.32 cent2.test.com ricci: 192.168.6.33 cent3.test.com ricci: 192.168.6.34 cent4.test.com

我这里已经配好了主机名了,但是其他的如时间同步,配置 /etc/hosts/ 等都没执行,为了方便,所以写了个 playbook 来进行初始化一下

--- - hosts:hdpservers remote_user: root vars: tasks: - name: add synctime cron cron: name='sync time' minute='*/5'job='/usr/sbin/ntpdate 192.168.6.31' - name: shutdown iptables service: name={{item.name}}state={{item.state}} enabled={{item.enabled}} with_items: - { name: iptables, state: stopped,enabled: no} - { name: NetworkManager, state: stopped,enabled: no} tags: stop service - name: copy selinux conf file copy: src={{item.src}} dest={{item.dest}}owner={{item.owner}} group={{item.group}} mode={{item.mode}} with_items: - { src=\'#\'" /etc/selinux/config', dest:/etc/selinux/config, owner: root, group: root, mode: '0644'} - { src=\'#\'" /etc/hosts', dest: /etc/hosts,owner: root, group: root, mode: '0644'} - name: cmd off selinux shell: setenforce 0

执行这个 playbook,进行初始化

[root@cent1 yaml]#ansible-playbook base.yml 4. 在 cent1 上安装 luci, luci 是一个 python 程序,依赖很多 python 包 [root@cent1 ~]#yum install luci

启动 luci

[root@cent3 ~]#/etc/init.d/luci start Adding followingauto-detected host IDs (IP addresses/domain names), corresponding to `cent3'address, to the configuration of self-managed certificate`/var/lib/luci/etc/cacert.config' (you can change them by editing`/var/lib/luci/etc/cacert.config', removing the generated certificate`/var/lib/luci/certs/host.pem' and restarting luci): (none suitable found, you can still doit manually as mentioned above) Generating a 2048bit RSA private key writing newprivate key to '/var/lib/luci/certs/host.pem' 正在启动saslauthd: [确定] Start luci... [确定] Point your webbrowser to https://cent1.hfln.com:8084 (or equivalent) to access luci

现在可以在前台登录 luci 了,看清是 https 哦


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

账号密码就是这台主机的账号和密码


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

登录成功啦 , 现在来配置 rhcs 的集群,这个只是用来管理集群的, 真正的集群还没开始装呢。

5. 在 cnet2, cent3, cent4 中安装 ricci, ricci 也依赖很多软件,这里使用 ansible 直接在三个节点上装, 当然我已经配好了 cent1 到 其他节点的免密钥登录了 [root@cent1 ~]#ansible rhcs -m yum -a "name=ricci"

装好 ricci 之后还要在 node 节点上给 ricci 用户设置密码, ricci 用户就是运行 ricci 进程的用户,这个密码一会要用 , 这里就简单粗暴了,这个密码还可以用 ccs 命令来进行设置

[root@cent1 ~]#ansible rhcs -m shell -a "echo '123456' | passwd --stdin ricci"

启动 ricci

[root@cent1 ~]#ansible rhcs -m service -a "name=ricci state=started enabled=yes" [root@cent2 ~]# ss-tunlp |grep ricci tcp LISTEN 0 5 :::11111 :::* users:(("ricci",3237,3))

ricci 监听在 11111 端口, 像这种操作当然也是可以写到 playbook 当中的

6. 现在可以在 web 界面上配置 集群了,比如创建 / 添加 / 删除一个集群,管理 node, resource, fence device, servicegroups, Failover Domains 等等集群的全生命周期都可以在这里完成。

这里演示一个关于 web 服务的高可用服务

Manage Clusters--> Create 是创建一个集群


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

这个界面还算简单吧;


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

Create Cluster 之后,那么就开始尝试安装集群软件了 .

在任意一个 node 上可以看到 ricci 的工作进程:

[root@cent2 ~]# psaux |grep ricci ricci 3453 0.1 0.4 213664 4400 ? S<s 17:18 0:00 ricci -u ricci ricci 3489 0.0 0.1 54912 1908 ? S<s 17:22 0:00 /usr/libexec/ricci/ricci-worker -f /var/lib/ricci/queue/1500004777 root 3490 0.2 0.5 48552 5136 ? S 17:22 0:00 ricci-modrpm root 3567 0.0 0.0 103252 880 pts/0 S+ 17:24 0:00 grep ricci

/var/lib/ricci/queue/ 目录下存放的是 luci 发给 ricci 的任务文件, 是 XML 格式的

[root@cent2 ~]#file /var/lib/ricci/queue/1500004777 /var/lib/ricci/queue/1500004777:XML document text 7. 安装成功了
CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

可以点任何一个 node 进去看看


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

如果这底下的服务没启动的话,可以尝试手动起一下,一般来说是 OK 的。

8. 添加资源

这里没有 fence 设备,不关注这个,添加两个公共资源,并添加一个服务,然后来启动服务

Resources -->Add : 添加一个资源


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群

添加一个虚拟 IP ,这里的 mask 要写成上面这样,不能写成 255.255.255.0 这种,否则会导致无法添加 IP

rgmanager Startingstopped service service:web1 rgmanager start onip "192.168.6.100/255.255.255.0" returned 1 (generic error) rgmanager #68:Failed to start service:web1; return value: 1

再添加一个 script 资源


CentOS 6.6 上使用 luci/ricci 安装配置 RHCS 集群
9. 添加 Service

这里的资源是共公的,假如这个集群内有多个服务,那么都可以使用这些资源,也可以在

Service Groups 里添加一个私有的资源。

现在添加一个 Service:

Servi

Viewing all articles
Browse latest Browse all 11063

Trending Articles