搭建osd和mds见https://my.oschina.net/u/2326998/blog/805779
一、添加radosgw(civetweb方式)
1、创建网关实例的数据目录
mkdir /var/lib/ceph/radosgw
mkdir /var/lib/ceph/radosgw/ceph-rgw.{name}
2、创建启动文件和done文件
touch /var/lib/ceph/radosgw/ceph-rgw.{name}/done
touch /var/lib/ceph/radosgw/ceph-rgw.{name}/systemd
3、创建用户使用的密钥
ceph auth get-or-create client.rgw.node3 osd "allow rwx" mon "allow rw" -o /var/lib/ceph/radosgw/ceph-rgw.{name}/keyring
cp /var/lib/ceph/radosgw/ceph-rgw.{name}/keyring /etc/ceph/ceph.client.rgw.{name}.keyring
4、把如下内容加入ceph.conf配置文件
[client.rgw.{name}]
rgw_frontends = "civetweb port=80"5、启动radosgw服务
systemctl enable ceph-radosgw.target
cd /etc/systemd/system/multi-user.target.wants
ln -s ./ceph-radosgw@rgw.{name}.service /lib/systemd/system/ceph-radosgw@.service
systemctl start ceph-radosgw@rgw.{name}.service
二、添加radosgw(nginx方式)
1、2、3、创建目录,创建用户见上步。
4、安装nginx
apt-get install nginx
5、修改ceph.conf配置文件,把client.rgw.{name} 部分修改如下:
[client.rgw.{name}]
rgw dns name = s3.ceph.work rgw frontends = fastcgi host = hostname keyring = /etc/ceph/ceph.client.rgw.keyring rgw socket path = /var/run/ceph/ceph-client.rgw.{name}.sock log file = /var/log/ceph/ceph-client.rgw.log rgw print continue = false rgw content length compat = true6、编辑/etc/nginx/nginx.conf文件 http部分修改为如下内容
server {
listen 80 default; server_name s3.ceph.work; client_max_body_size 0; location / { fastcgi_pass_header Authorization; fastcgi_pass_request_headers on; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param HTTP_CONTENT_LENGTH $content_length; if ($request_method = PUT) { rewrite ^ /PUT$request_uri; } include fastcgi_params; fastcgi_pass unix:/var/run/ceph/ceph-client.rgw.node-209.sock; } location /PUT/ { internal; fastcgi_pass_header Authorization; fastcgi_pass_request_headers on; include fastcgi_params; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param HTTP_CONTENT_LENGTH $content_length; fastcgi_pass unix:/var/run/ceph/ceph-client.rgw.node-209.sock; } }note:修改文件中开头的user 用户,修改为和sock用户相同,或者注销 user
7、启动服务
用curl http://hostname 测试。
出现如下内容说明搭建成功
<?xml version="1.0" encoding="UTF-8"?><ListAllMyBucketsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Owner><ID>anonymous</ID><DisplayName></DisplayName></Owner><Buckets></Buckets></ListAllMyBucketsResult>