ceph之centos7.6.1810手动部署ceph-radosgw


一、使用civetweb配置

1.构建第一个radosgw

1)安装ceph-radosgw

yum install ceph-radosgw -y

  

2)创建pool,先忽略

cat pool
.rgw
.rgw.root
.rgw.control
.rgw.gc
.rgw.buckets
.rgw.buckets.index
.rgw.buckets.extra
.log
.intent-log
.usage
.users
.users.email
.users.swift
.users.uid

create-pool.sh
#!/bin/bash
PG_NUM=64
PGP_NUM=64
SIZE=3

for i in `cat /root/pool`
        do
        ceph osd pool create $i $PG_NUM
        ceph osd pool set $i size $SIZE
        done
for i in `cat /root/pool`
        do
        ceph osd pool set $i pgp_num $PGP_NUM
        done

  

3)创建keyring

ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
creating /etc/ceph/ceph.client.radosgw.keyring

cat /etc/ceph/ceph.client.radosgw.keyring
生成的是空文件

  

4)修改文件权限

chown ceph:ceph /etc/ceph/ceph.client.radosgw.keyring

  

5)生成ceph-radosgw服务对应的用户和key

ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.rgw.ceph4 --gen-key

cat /etc/ceph/ceph.client.radosgw.keyring
[client.rgw.ceph4]
	key = AQCL6s5cilxrIBAA8N40PhP2GAgsmC2dwU3Sig==

  

6)为用户添加访问权限

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

cat /etc/ceph/ceph.client.radosgw.keyring
[client.rgw.ceph4]
	key = AQCL6s5cilxrIBAA8N40PhP2GAgsmC2dwU3Sig==
	caps mon = "allow rwx"
	caps osd = "allow rwx"

  

7)导入keyring到集群中

ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.rgw.ceph4 -i /etc/ceph/ceph.client.radosgw.keyring
added key for client.rgw.ceph4

ceph auth list |grep -A 3 rgw
installed auth entries:

client.rgw.ceph4
	key: AQCL6s5cilxrIBAA8N40PhP2GAgsmC2dwU3Sig==
	caps: [mon] allow rwx
	caps: [osd] allow rwx

  

8)配置ceph.conf

[client.rgw.ceph4]
host=ceph4
keyring=/etc/ceph/ceph.client.radosgw.keyring
log file=/var/log/radosgw/client.radosgw.gateway.log
rgw_s3_auth_use_keystone = False
rgw_frontends = civetweb port=8080

  

9)创建日志目录并修改权限

mkdir /var/log/radosgw
chown ceph:ceph /var/log/radosgw

  

10)启动radosgw

systemctl start ceph-radosgw@rgw.ceph4
systemctl status ceph-radosgw@rgw.ceph4

  

启动rgw,会出现4个pool

[root@ceph4 ~]# ceph osd lspools
1 .rgw.root,2 default.rgw.control,3 default.rgw.meta,4 default.rgw.log,
[root@ceph4 ~]# ceph df
GLOBAL:
    SIZE        AVAIL       RAW USED     %RAW USED 
    29.4GiB     23.3GiB      6.13GiB         20.84 
POOLS:
    NAME                    ID     USED        %USED     MAX AVAIL     OBJECTS 
    .rgw.root               1      1.09KiB         0       7.27GiB           4 
    default.rgw.control     2           0B         0       7.27GiB           8 
    default.rgw.meta        3           0B         0       7.27GiB           0 
    default.rgw.log         4           0B         0       7.27GiB         175 

  

11)查看端口监听状态

netstat -antup |grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      25815/radosgw 

  

12)设置开机自启

systemctl enable ceph-radosgw@rgw.ceph4

  

2.构建第二个radosgw,(一台主机启动多实例)

1)创建keyring

ceph-authtool --create-keyring /etc/ceph/ceph.client.ceph4-2.keyring
creating /etc/ceph/ceph.client.ceph4-2.keyring

cat /etc/ceph/ceph.client.ceph4-2.keyring
生成的是空文件

  

2)修改文件权限

chown ceph:ceph /etc/ceph/ceph.client.ceph4-2.keyring

  

3)生成ceph-radosgw服务对应的用户和key

ceph-authtool /etc/ceph/ceph.client.ceph4-2.keyring -n client.rgw.ceph4-2 --gen-key

cat /etc/ceph/ceph.client.ceph4-2.keyring
[client.rgw.ceph4-2]
	key = AQBy+s5cKQNtLRAAfxC7wcnZi0HvgBwtHN7Brw==

  

4)为用户添加访问权限

ceph-authtool -n client.rgw.ceph4-2 --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.ceph4-2.keyring

cat /etc/ceph/ceph.client.ceph4-2.keyring
[client.rgw.ceph4-2]
	key = AQBy+s5cKQNtLRAAfxC7wcnZi0HvgBwtHN7Brw==
	caps mon = "allow rwx"
	caps osd = "allow rwx"

  

5)导入keyring到集群中

ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.rgw.ceph4-2 -i /etc/ceph/ceph.client.ceph4-2.keyring
added key for client.rgw.ceph4-2

ceph auth list |grep -A 3 rgw.ceph4-2
installed auth entries:

client.rgw.ceph4-2
	key: AQBy+s5cKQNtLRAAfxC7wcnZi0HvgBwtHN7Brw==
	caps: [mon] allow rwx
	caps: [osd] allow rwx

  

6)配置ceph.conf

[client.rgw.ceph4-2]
host=ceph4
keyring=/etc/ceph/ceph.client.ceph4-2.keyring
log file=/var/log/radosgw/client.ceph4-2.log
rgw_s3_auth_use_keystone = False
rgw_frontends = civetweb port=8082

  

7)启动radosgw

systemctl start ceph-radosgw@rgw.ceph4-2
systemctl status ceph-radosgw@rgw.ceph4-2

  

8)查看端口监听状态

netstat -antup |grep 8082
tcp        0      0 0.0.0.0:8082            0.0.0.0:*               LISTEN      28356/radosgw  

  

9)设置开机自启
systemctl enable ceph-radosgw@rgw.ceph4-2

 

10)验证俩个实例,均是正常提供服务

netstat -tnlp |grep radosgw
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      25815/radosgw       
tcp        0      0 0.0.0.0:8082            0.0.0.0:*               LISTEN      28356/radosgw       

  

[root@ceph4 ~]# curl ceph4:8080
<?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>[root@ceph4 ~]# 
[root@ceph4 ~]# curl ceph4:8082
<?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>[root@ceph4 ~]# 

  

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM