好几天没有更新博客了,这几天分配有任务:calamari与inscope管理系统调研。下面就管理系统的环境搭建做一个总结,总结一下搭建流程以及搭建过程中遇到的一些问题。calcamari的搭建相对简单些这里就不说了,主要是inscope管理系统的环境搭建。
搭建成功演示参考:
http://www.zphj1987.com/2015/10/12/inkscope%E7%AE%A1%E7%90%86%E5%B9%B3%E5%8F%B0%E8%AF%95%E7%94%A8/
参考文章:
http://cloud.51cto.com/art/201507/486005_all.htm
http://blog.csdn.net/changtao381/article/details/48015623
Host | IP | Node |
---|---|---|
admin99 | 10.10.21.99 | osd |
node100 | 10.10.21.100 | osd/mon |
node101 | 10.10.21.101 | osd/rgw |
调研搭建Inscope最新版本:V1.3.1
源码路径:https://github.com/inkscope/inkscope/tree/V1.3.1
相关包:https://github.com/inkscope/inkscope-packaging/tree/1.3.1-2/RPMS
1)、由Inscope源码可知,管理系统的实现主要包含有:
InscopeViz:包含inkscope的web控制台文件,含接口和界面相关文件
InscopeCtrl
InscopeProbe
InscopeMonitor
2)、如下Inscope框架
由架构图可知,整个集群管理系统Inscope的构成依赖于其核心组件在各个节点的信息通讯,而Inscope的搭建正是要将各个组件(进程)成功地嵌入(运行)在各个功能节点上。Inscope搭建的主要内容有:
3)、各个节点需安装的Inscope组件内容
Host | 安装包 |
---|---|
admin99 | Inscope-common / Inscope-admViz / Inscope-sysprobe / Inscope-cephprobe / flask / mongodb |
node100 | Inscope-common / Inscope-cephrestapi / Inscope-cephprobe / Inscope-sysprobe |
node101 | Inscope-common / Inscope-sysprobe |
该节点使用php以及wsgi实现界面,本地接收其他节点传过来的数据存入本地mongodb,同时会调用rados命令,
又使用flask框架构建接口,因此需要使用下面的命令安装软件及依赖(注:均为最新包)
yum install python-pip httpd mod_wsgi mongodb python-ceph python-flask
rpm -ivh inkscope-admviz-1.3.1-2.noarch.rpm inkscope-common-1.3.1-2.noarch.rpm inkscope-sysprobe-1.3.1-2.noarch.rpm
安装完Inkscope-admviz后默认虚拟主机配置文件位于/etc/httpd/conf.d/inkScope.conf,将其拷贝到/etc/httpd/sites-available 中。修改36行如下, 注释掉 35行
35 #ProxyPass /ceph-rest-api/ http://<inkscope_host> \<inkscope_port>/ceph_rest_api/api/v0.1/
36 ProxyPass /ceph-rest-api/ http://10.10.21.100:5000/api/v0.1/
同时修改 /etc/httpd/conf/httpd.conf配置文件,增添:
Listen 8080
NameVirtualHost *.8080
完整的Inscope.conf 文件(本人环境)
[root@admin99 site-available]# cat inkScope.conf
<VirtualHost *:8080>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot /var/www/inkscope
<Directory "/var/www/inkscope">
Options All
AllowOverride All
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /inkscopeCtrl /var/www/inkscope/inkscopeCtrl/inkscopeCtrl.wsgi
<Directory "/var/www/inkscope/inkScopeCtrl">
Order allow,deny
Allow from all
</Directory>
WSGIScriptAlias /ceph_rest_api /var/www/inkscope/inkscopeCtrl/ceph-rest-api.wsgi
<Directory "/var/www/inkscope/inkScopeCtrl">
Require all granted
</Directory>
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
ProxyRequests Off # we want a "Reverse proxy"
#ProxyPass /ceph-rest-api/ http://<inkscope_host>:<inkscope_port>/ceph_rest_api/api/v0.1/
ProxyPass /ceph-rest-api/ http://10.10.21.100:5000/api/v0.1/
ErrorLog /var/log/inkscope/webserver_error.log
CustomLog /var/log/inkscope/webserver_access.log common
</VirtualHost>
重新启动httpd 执行 # service httpd restart
之后打开浏览器访问 http://10.10.21.99:8080/ 便可看到Inscope首页信息了,不过此时没有Ceph集群的信息。
修改 /etc/mongodb.conf ,将bind_ip 修改为 0.0.0.0,取消 port = 27017 依据前面的注释,如下:
bind_ip = 0.0.0.0
port = 27017
cephprobe所在节点主要是提供ceph-rest-api并实现抓取ceph的信息存入mongodb中。所需软件包及依赖安装如下:
yum install python-devel
pip install pymongo psutil
rpm -ivh inkscope-common-1.3.1-2.noarch.rpm inkscope-cephrestapi-\
1.3.1-2.noarch.rpm inkscope-cephprobe-1.3.1-2.noarch.rpm inkscope-\
sysprobe-1.3.1-2.noarch.rpm
启动ceph-rest-api服务 /etc/init.d/ceph-rest-api start
注:本次搭建避免了ceph的auth认证,radosgw有两种方式运行,一种是直接用civetweb的方式,其内置了一个比较小巧的http服务器mongoose,这种方式配置比较简单,不需要配置Apache httpd服务器。下面说的是后者的配置即Apache httpd配置。
1)创建rgw相关的pool
ceph osd pool create .rgw 64 64
ceph osd pool create .rgw.root 64 64
ceph osd pool create .rgw.control 64 64
ceph osd pool create .rgw.gc 64 64
ceph osd pool create .rgw.buckets 64 64
ceph osd pool create .rgw.buckets.index 64 64
ceph osd pool create .log 64 64
ceph osd pool create .intent-log 64 64
ceph osd pool create .usage 64 64
ceph osd pool create .users 64 64
ceph osd pool create .users.email 64 64
ceph osd pool create .users.swift 64 64
ceph osd pool create .users.uid 64 64
2)配置 ceph.conf
2-1)这里的配置需在ceph.conf里添加有个radowgw的配置, apache httpd + factcgi的方式。
[client.radosgw.node101]
host = node101
log_file = /var/log/ceph/client.radosgw.node101.log
log_socket_path = /var/run/ceph/ceph-client.radosgw.node101.asok
rgw_frontends = fastcgi socket_port=9000 socket_host=0.0.0.0
rgw_print_continue = false
2-1)配置安装fastcgi模块
需下载源码包,目前最新包版本:mod_fastcgi-2.4.6-2.rf.src.rpm ,使用rpmbuild编译安装,make编译过程会遇到一些问题,可参考:http://www.th7.cn/system/lin/201411/77339.shtml 解决
radosgw -c /etc/ceph/ceph.conf -n client.radosgw.node101
查看 /var/log/ceph/client.radosgw.node101.log 据日志做相应处理
当试图启用ceph.conf中添加的[client.radosgw.node101]项时,报如下错:
[root@node101 radosgw]# radosgw -c /etc/ceph/ceph.conf -n client.radosgw.node101
[root@node101 radosgw]# tail -f /var/log/ceph/client.radosgw.node101.log
分析:ceph radosgw默认的运行方式是civetweb方式,由日志来看,似乎添加的[client.radosgw.node101]并没有发挥作用。
要想获取或者说使用radosgw提供对象存储,而又Inscope能够(从子用户)获取到相应的信息资源,那么就得实现相关通讯,而通讯使用的是socket机制,即需实现绑定Ceph-radosgw的/var/run/ceph/ceph-client.radosgw.node101.asok 文件。
解决可参考:http://comments.gmane.org/gmane.comp.file-systems.ceph.user/24084
重启服务可使用如下形式:
radosgw -d -c /etc/ceph/ceph.conf --debug-rgw 20
--rgw-socket-path=/var/run/ceph/ceph-client.radosgw.node101.asok
在/etc/httpd/conf.d 目录中添加rgw.conf
<VirtualHost *:80>
ServerName 10.10.21.101
DocumentRoot /var/www/html
ErrorLog /var/log/httpd/rgw_error.log
CustomLog /var/log/httpd/rgw_access.log combined
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
SetEnv proxy-nokeepalive 1
ProxyPass / fcgi://10.10.21.101:9000/
#ProxyPass / http://10.10.21.101:9000/
</VirtualHost>
重启httpd服务 service httpd restart
radosgw-admin user create --uid=cephtest --display-name="cephtest"
--email=ceph.test@chinacache.com
查看用户信息:radosgw-admin user info –uid=cephtest
{
"user_id": "cephtest",
"display_name": "jeceph",
"email": "[email protected]",
"suspended": 0,
"max_buckets": 1000,
"auid": 0,
"subusers": [],
"keys": [ { "user": "cephtest", "access_key": "S0I0O8YFF3RLOCMI72C7", "secret_key": "Gu3sJeEatxs4lNWa4JgRL2HOMny7XwE7WVilbEs7" } ],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"placement_tags": [],
"bucket_quota": { "enabled": false, "max_size_kb": -1, "max_objects": -1 },
"user_quota": { "enabled": false, "max_size_kb": -1, "max_objects": -1 },
"temp_url_keys": [] }
安装内容:
yum install python-devel
pip install pymongo psutil
rpm -ivh inkscope-common_1.3.1-2.deb inkscope-sysprobe_1.3.1-2.deb
inkscope的配置文件就一个,位于 /opt/inkscope/etc/inkscope.conf
这里面需要修改的主要有: 1. ceph_rest_api:在本例中即为node100的ip; 2. mongodb_host:即为amin99所在节点,管理节点 ;3. radosgw_url:即为node101所在节点 ;4. radosgw_key和radosgw_secret:在node101上新建管理用户时指定的两个key
文件配置结果:
{
"ceph_conf": "/etc/ceph/ceph.conf",
"ceph_rest_api": "10.10.21.100:5000",
"ceph_rest_api_subfolder": "",
"mongodb_host" : "10.10.21.99",
"mongodb_set" : "mongodb0:27017,mongodb1:27017,mongodb2:27017",
"mongodb_replicaSet" : "replmongo0",
"mongodb_read_preference" : "ReadPreference.SECONDARY_PREFERRED",
"mongodb_port" : 27017,
"mongodb_user":"ceph",
"mongodb_passwd":"monpassword",
"is_mongo_authenticate" : 0,
"is_mongo_replicat" : 0,
"cluster": "ceph",
"platform": "x86_64",
"status_refresh": 3,
"osd_dump_refresh": 3,
"pg_dump_refresh": 60,
"crushmap_refresh": 60,
"df_refresh": 60,
"cluster_window": 1200,
"osd_window": 1200,
"pool_window": 1200,
"mem_refresh": 60,
"swap_refresh": 600,
"disk_refresh": 60,
"partition_refresh": 60,
"cpu_refresh": 30,
"net_refresh": 30,
"mem_window": 1200,
"swap_window": 3600,
"disk_window": 1200,
"partition_window": 1200,
"cpu_window": 1200,
"net_window": 1200,
"radosgw_url": "http://10.10.21.101:80",
"radosgw_admin": "admin",
"radosgw_key": "S0I0O8YFF3RLOCMI72C7",
"radosgw_secret": "Gu3sJeEatxs4lNWa4JgRL2HOMny7XwE7WVilbEs7" }
之后,将该文件拷贝至Ceph集群各个节点的 /opt/inscope/etc/目录中。
最终,启动各个节点的服务:
service sysprobe start service cephprobe start service ceph-rest-api start