Chinaunix首页 | 论坛 | 博客
  • 博客访问: 463299
  • 博文数量: 145
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1139
  • 用 户 组: 普通用户
  • 注册时间: 2014-01-14 16:47
个人简介

路漫漫其修远兮,吾将上下而求索

文章分类

全部博文(145)

文章存档

2016年(10)

2015年(15)

2014年(120)

我的朋友

分类: 系统运维

2016-12-19 21:17:58

于已部署好的Ceph集群,部署一个网关服务器,进行对象存储服务。全文分别对依赖包安装、配置、验证做了详细说明。该过程经过实际验证

点击(此处)折叠或打开

  1. 引言
  2. 基于已部署好的Ceph集群,部署一个网关服务器,进行对象存储服务。操作系统CentOS6.5 CEPH0.94.3其实基于librados可以直接进行访问,但是我看了百度,UCLOUD的对象存储,用户在网页上进行文件的上传、下载时,都通过web服务器间接和存储集群打交道,进行了一层隔离,而不是直接和集群进行通信操作。我得理解是便于访问控制以及隔离。

1.依赖包安装

Ceph rados-gateway依赖Apache和FastCGI, 用户的请求先到web服务器,再走rados-gateway进入集群之中。

1.1 安装Apache服务

一般的apache版本都是2.2,但是没有mod_proxy_fcgi,所以我们直接安装apache 2.4版本的!

点击(此处)折叠或打开

  1. 安装apache2.4
  2. 执行
  3. cd /etc/yum.repos.d
  4. wget
  5. wget
  6. 建议先把已安装的卸载掉(上面已有apache2.2)
  7. 查看已安装
  8. yum list installed httpd*
  9. 卸载
  10. yum remove httpd
  11. 查看可安装httpd
  12. yum list httpd*
  13. 安装
  14. yum install httpd24-httpd httpd24-httpd-devel httpd24-mod_ssl hhvm

1.2 配置http服务器


点击(此处)折叠或打开

  1. [root@hhly001 conf]# pwd
  2. /opt/rh/httpd24/root/etc/httpd/conf
将ServerName的注释号去掉,添加上自己网关服务器的IP地址

点击(此处)折叠或打开

  1. 272 # If your host doesn't have a registered DNS name, enter its IP address here.
  2. 273 # You will have to access it by its address anyway, and this will make
  3. 274 # redirections work in a sensible way.
  4. 275 #
  5. 276 ServerName 192.168.12.12:80
在配置中增加如下信息,加载mod_proxy_fcgi

点击(此处)折叠或打开

  1. LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
此处需注意,需要将该段内容加载LoadModule系列的后面,否则会报如下错误:

点击(此处)折叠或打开

  1. service httpd start
  2. Starting httpd: httpd: Syntax error on line 129 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_proxy_fcgi.so into server: /etc/httpd/modules/mod_proxy_fcgi.so: undefined symbol: ap_proxy_release_connection
修改配置中的LISTEN字段,将网关所在主机的IP地址添加进去

点击(此处)折叠或打开

  1. # Listen: Allows you to bind Apache to specific IP addresses and/or
  2. # ports, in addition to the default. See also the
  3. # directive.
  4. #
  5. # Change this to Listen on specific IP addresses as shown below to
  6. # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
  7. #
  8. Listen 192.168.12.12:80
  9. #Listen 80

1.3 SSL支持 (此处是否必须不是很清楚,只是按照官方文档走)

秘钥文件生成


点击(此处)折叠或打开

  1. yum install mod_ssl openssl
  2. openssl genrsa -out ca.key 2048
  3. openssl req -new -key ca.key -out ca.csr
  4. openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt

文件目录放置sudo cp ca.crt /etc/pki/tls/certs

点击(此处)折叠或打开

  1. sudo cp ca.key /etc/pki/tls/private/ca.key
  2. sudo cp ca.csr /etc/pki/tls/private/ca.csr

配置文件修改[root@hhly001 conf.d]# pwd
/opt/rh/httpd24/root/etc/httpd/conf.d

点击(此处)折叠或打开

  1. SSLCertificateFile /etc/pki/tls/certs/ca.crt
  2. SSLCertificateKeyFile /etc/pki/tls/private/ca.key
重启httpd服务sudo service httpd restart


1.4 网关服务安装

点击(此处)折叠或打开

  1. yum install ceph-radosgw
至此,相关依赖包安装完毕


2. CEPH网关服务配置
ceph网关其实是ceph集群的一个客户端,用户通过这个网关间接访问ceph集群,作为客户端,它需要准备如下内容:
网关名称,此处用gateway称呼
一个可以访问存储集群的用户以及对应的KEYRING
数据资源池,这个由ceph集群提供
为网关服务示例准备一个数据存放空间
在ceph.conf配置文件中设置gateway信息
2.1 创建访问用户及权限设置
创建gateway keyring,一开始该文件为空

点击(此处)折叠或打开

  1. sudo ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
  2. sudo chmod +r /etc/ceph/ceph.client.radosgw.keyring
创建网关用户名以及key 此处名字为 client.radosgw.gateway

点击(此处)折叠或打开

  1. ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.radosgw.gateway --gen-key
为KEYRING添加权限


点击(此处)折叠或打开

  1. ceph-authtool -n client.radosgw.gateway --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring

将key添加到集群中

点击(此处)折叠或打开

  1. sudo ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.gateway -i /etc/ceph/ceph.client.radosgw.keyring

将相关的KEYRING文件拷贝到rados-gateway所在的主机 /etc/ceph/目录下


2.2 数据资源池创建


点击(此处)折叠或打开

  1. [root@hhly001 conf.d]# rados lspools
  2. mytest
  3. .rgw
  4. .rgw.root
  5. .rgw.control
  6. .rgw.gc
  7. .rgw.buckets
  8. .rgw.buckets.index
  9. .log
  10. .intent-log
  11. .usage
  12. .users
  13. .users.email
  14. .users.swift
  15. .users.uid

点击(此处)折叠或打开

  1. ceph osd pool create .rgw 128 128
  2. ceph osd pool create .rgw.root 128 128
  3. ceph osd pool create .rgw.control 128 128
  4. ceph osd pool create .rgw.gc 128 128
  5. ceph osd pool create .rgw.buckets 128 128
  6. ceph osd pool create .rgw.buckets.index 128 128
  7. ceph osd pool create .log 128 128
  8. ceph osd pool create .intent-log 128 128
  9. ceph osd pool create .usage 128 128
  10. ceph osd pool create .users 128 128
  11. ceph osd pool create .users.email 128 128
  12. ceph osd pool create .users.swift 128 128
  13. ceph osd pool create .users.uid 128 128
2.3 将网关配置信息添加到集群配置中

点击(此处)折叠或打开

  1. [client.radosgw.gateway]
  2. host=hhly001
  3. keyring=/etc/ceph/ceph.client.radosgw.keyring
  4. rgw socket path=/var/run/ceph/ceph.radosgw.gateway.fastcgi.sock
  5. log file=/var/log/radosgw/client.radosgw.gateway.log
  6. rgw frontends=fastcgi socket_port=9000 socket_host=0.0.0.0
  7. rgw print continue=false

2.4 目录及权限调整

创建数据目录


点击(此处)折叠或打开

  1. sudo mkdir -p /var/lib/ceph/radosgw/ceph-radosgw.gateway
  2. 调整apache运行权限
  3. sudo chown apache:apache /var/run/ceph
调整日志权限

点击(此处)折叠或打开

  1. sudo chown apache:apache /var/log/radosgw/client.radosgw.gateway.log

启动网关服务sudo /etc/init.d/ceph-radosgw start

2.5 网关配置文件

一个配置文件,用于web server和FastCGI之间的交互
sudo vi /etc/httpd/conf.d/rgw.conf

点击(此处)折叠或打开

  1. [root@hhly001 conf.d]# cat rgw.conf
  2. ServerName 192.168.12.12
  3. DocumentRoot /opt/rh/httpd24/root/var/www/html
  4. ErrorLog /var/log/httpd/rgw_error.log
  5. CustomLog /var/log/httpd/rgw_access.log combined
  6. RewriteEngine On
  7. RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
  8. SetEnv proxy-nokeepalive 1
  9. ProxyPass / fcgi://192.168.12.12:9000/









阅读(2951) | 评论(0) | 转发(0) |
0

上一篇:centos6.5部署搭建ceph

下一篇:没有了

给主人留下些什么吧!~~