radosgw-admin user create --uid=“user1” --display-name=“user1” #创建用户
sudo apt install s3cmd
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd --configure
Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
Access Key [XLVICL3ICLLW2XEHN1CP]:
Secret Key [3Znj6hsCe10jIJ6MSH5A3nCtnywjDCnJi26GORik]:
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd mb s3://luo #创建Bucket
Bucket ‘s3://luo/’ created
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd ls #查看所有Bucket
2023-06-05 15:21 s3://luo
2023-06-05 15:20 s3://luohw
2023-06-05 15:20 s3://myserve
上传文件test.json文件到myserver bucket
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd put test.json s3://myserver
列出bucket中文件
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd ls s3://myserver
2024-06-04 05:04 183 s3://myserver/test.json
下载myserver中的test.json文件到/tmp
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd get s3://myserver/test.json /tmp/
上传
cephadmin@ceph-mgr01:~/ceph-cluster/s3/image$ s3cmd put toux.png s3://myserver
默认没有权限
设置权限
cat myserver.json
{"Version": "2012-10-17","Statement": [{"Effect": "Allow","Principal": {"AWS": "*"},"Action": "s3:GetObject","Resource": ["arn:aws:s3:::myserver/*" ]}]
}
应用
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd setpolicy myserver.json s3://myserver
s3://myserver/: Policy updated
列出文件
cephadmin@ceph-mgr01:~/ceph-cluster/s3$ s3cmd ls s3://myserver
2024-06-04 05:04 183 s3://myserver/test.json
2024-06-04 05:10 931111 s3://myserver/toux.png
访问
http://192.168.1.93:9900/luohw/toux.png
配置负载均衡
listen ceph-9900
bind 192.168.1.61:80
mode tcp
server 92 192.168.1.92:9900 check inter 3s fall 3 rise 3
server 93 192.168.1.93:9900 check inter 3s fall 3 rise 3
listen ceph-9443
bind 192.168.1.61:443
mode tcp
server 92 192.168.1.92:9443 check inter 3s fall 3 rise 3
server 93 192.168.1.93:9443 check inter 3s fall 3 rise 3