美文网首页
ceph rgw操作(civetweb/nginx)

ceph rgw操作(civetweb/nginx)

作者: SkTj | 来源:发表于2019-03-03 13:20 被阅读14次

1、默认使用civetweb做web server
2、civetweb部署方式:
//部署需要到存在ceph.bootstrap-rgw.keyring文件的目录里
cd /home/cephuser/cluster/
ceph-deploy rgw create ceph-admin //在主机名上创建
默认的端口时7480,可以通过ceph.conf修改
[client]
rgw frontends = civetweb port=666
修改完,重启:radosgw restart
检查服务是否启动:ps -ef|grep radosgw
3、ngixn方式
yum install -y radosgw nginx
新建用户和keying(在每台主机上建一个用户和key)
ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
chmod +r /etc/ceph/ceph.client.radosgw.keyring
ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.rgw.node1 --gen-key
sudo ceph-authtool -n client.rgw.node1 --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring
sudo ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.rgw.node1 -i /etc/ceph/ceph.client.radosgw.keyring
////配置ceph.conf,这个配置文件放到三台node中去
[client.rgw.node1]
rgw frontends=fastcgi socket_port=9000 socket_host=0.0.0.0
host=ceph-node1
keyring=/etc/ceph/ceph.client.radosgw.keyring
log file=/var/log/radosgw/client.radosgw.gateway.log
rgw print continue=false
rgw content length compat = true

[client.rgw.node2]
rgw frontends=fastcgi socket_port=9000 socket_host=0.0.0.0
host=ceph-node2
keyring=/etc/ceph/ceph.client.radosgw.keyring
log file=/var/log/radosgw/client.radosgw.gateway.log
rgw print continue=false
rgw content length compat = true

[client.rgw.node3]
rgw frontends=fastcgi socket_port=9000 socket_host=0.0.0.0
host=ceph-node3
keyring=/etc/ceph/ceph.client.radosgw.keyring
log file=/var/log/radosgw/client.radosgw.gateway.log
rgw print continue=false
rgw content length compat = true

4、nginx配置
server {
listen 80;
server_name ceph-node1;
location / {
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
fastcgi_param QUERY_STRING query_string; fastcgi_param REQUEST_METHODrequest_method;
fastcgi_param CONTENT_LENGTH content_length; fastcgi_param CONTENT_LENGTHcontent_length;
if (request_method = PUT) { rewrite ^ /PUTrequest_uri;
}
include fastcgi_params;
fastcgi_pass 192.168.1.10:9000;
}
location /PUT/ {
internal;
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
include fastcgi_params;
fastcgi_param QUERY_STRING query_string; fastcgi_param REQUEST_METHODrequest_method;
fastcgi_param CONTENT_LENGTH content_length; fastcgi_param CONTENT_TYPEcontent_type;
fastcgi_pass 192.168.1.10:9000;
}
}
server {
listen 80;
server_name ceph-node2;
location / {
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
fastcgi_param QUERY_STRING query_string; fastcgi_param REQUEST_METHODrequest_method;
fastcgi_param CONTENT_LENGTH content_length; fastcgi_param CONTENT_LENGTHcontent_length;
if (request_method = PUT) { rewrite ^ /PUTrequest_uri;
}
include fastcgi_params;
fastcgi_pass 192.168.1.11:9000;
}

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_pass 192.168.1.11:9000;
}

}
server {
listen 80;
server_name node3;
location / {
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
fastcgi_param QUERY_STRING query_string; fastcgi_param REQUEST_METHODrequest_method;
fastcgi_param CONTENT_LENGTH content_length; fastcgi_param CONTENT_LENGTHcontent_length;
if (request_method = PUT) { rewrite ^ /PUTrequest_uri;
}
include fastcgi_params;
fastcgi_pass 192.168.1.12:9000;
}
location /PUT/ {
internal;
fastcgi_pass_header Authorization;
fastcgi_pass_request_headers on;
include fastcgi_params;
fastcgi_param QUERY_STRING query_string; fastcgi_param REQUEST_METHODrequest_method;
fastcgi_param CONTENT_LENGTH content_length; fastcgi_param CONTENT_TYPEcontent_type;
fastcgi_pass 192.168.1.12:9000;
}
}

5、重启nginx,重启radosgw

相关文章

网友评论

      本文标题:ceph rgw操作(civetweb/nginx)

      本文链接:https://www.haomeiwen.com/subject/msypuqtx.html