本次演示环境配置如下:
hostname |
IP |
roles |
node01.srv.world |
192.168.10.101 |
Object Storage;Monitor Daemon;Manager Daemon |
node02.srv.world |
192.168.10.102 |
Object Storage |
node03.srv.world |
192.168.10.103 |
Object Storage |
dlp.srv.world |
192.168.10.142 |
client |
www.srv.world |
192.168.10.140 |
RADOSGW |
1.为RADOSGW配置互信
[root@node01 ~]# ssh-copy-id www
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'www (192.168.10.140)' can't be established.
ED25519 key fingerprint is SHA256:GL/hrF9YUQBElM3B+Yk0QYXWjao206qNGF+Quwqm4I4.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:16: 192.168.10.140
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@www's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'www'"
and check to make sure that only the key(s) you wanted were added.
2.为RADOSGW主机安装需要的软件包
[root@node01 ~]# ssh www "dnf -y install centos-release-ceph-reef epel-release; dnf -y install ceph-radosgw"
CentOS Stream 9 - BaseOS 348 kB/s | 7.8 MB 00:23
CentOS Stream 9 - AppStream 1.4 MB/s | 18 MB 00:13
CentOS Stream 9 - Extras packages 719 B/s | 14 kB 00:19
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
centos-release-ceph-reef noarch 1.0-1.el9s extras-common 7.3 k
epel-release noarch 9-7.el9 extras-common 19 k
Installing dependencies:
centos-release-storage-common noarch 2-5.el9s extras-common 8.3 k
Installing weak dependencies:
epel-next-release noarch 9-7.el9 extras-common 8.1 k
Transaction Summary
================================================================================
Install 4 Packages
Total download size: 42 k
Installed size: 32 k
Downloading Packages:
(1/4): centos-release-ceph-reef-1.0-1.el9s.noar 47 kB/s | 7.3 kB 00:00
(2/4): centos-release-storage-common-2-5.el9s.n 53 kB/s | 8.3 kB 00:00
(3/4): epel-next-release-9-7.el9.noarch.rpm 51 kB/s | 8.1 kB 00:00
(4/4): epel-release-9-7.el9.noarch.rpm 368 kB/s | 19 kB 00:00
--------------------------------------------------------------------------------
Total 30 kB/s | 42 kB 00:01
CentOS Stream 9 - Extras packages 25 kB/s | 2.1 kB 00:00
Importing GPG key 0x1D997668:
Userid : "CentOS Extras SIG (https://wiki.centos.org/SpecialInterestGroup) "
Fingerprint: 363F C097 2F64 B699 AED3 968E 1FF6 A217 1D99 7668
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : epel-release-9-7.el9.noarch 1/4
Running scriptlet: epel-release-9-7.el9.noarch 1/4
Many EPEL packages require the CodeReady Builder (CRB) repository.
It is recommended that you run /usr/bin/crb enable to enable the CRB repository.
Installing : epel-next-release-9-7.el9.noarch 2/4
Installing : centos-release-storage-common-2-5.el9s.noarch 3/4
Installing : centos-release-ceph-reef-1.0-1.el9s.noarch 4/4
Running scriptlet: centos-release-ceph-reef-1.0-1.el9s.noarch 4/4
Verifying : centos-release-ceph-reef-1.0-1.el9s.noarch 1/4
Verifying : centos-release-storage-common-2-5.el9s.noarch 2/4
Verifying : epel-next-release-9-7.el9.noarch 3/4
Verifying : epel-release-9-7.el9.noarch 4/4
Installed:
centos-release-ceph-reef-1.0-1.el9s.noarch
centos-release-storage-common-2-5.el9s.noarch
epel-next-release-9-7.el9.noarch
epel-release-9-7.el9.noarch
Complete!
CentOS-9-stream - Ceph Reef 4.7 kB/s | 32 kB 00:06
Extra Packages for Enterprise Linux 9 - x86_64 1.9 MB/s | 19 MB 00:09
Extra Packages for Enterprise Linux 9 openh264 318 B/s | 2.5 kB 00:07
Extra Packages for Enterprise Linux 9 - Next - 175 kB/s | 1.3 MB 00:07
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
ceph-radosgw x86_64 2:18.2.0-1.el9s centos-ceph-reef 7.1 M
Installing dependencies:
boost-program-options x86_64 1.75.0-8.el9 appstream 107 k
ceph-base x86_64 2:18.2.0-1.el9s centos-ceph-reef 4.9 M
ceph-common x86_64 2:18.2.0-1.el9s centos-ceph-reef 18 M
ceph-selinux x86_64 2:18.2.0-1.el9s centos-ceph-reef 26 k
daxctl-libs x86_64 71.1-8.el9 baseos 42 k
fmt x86_64 8.1.1-5.el9 epel 111 k
gperftools-libs x86_64 2.9.1-2.el9 epel 309 k
libarrow x86_64 9.0.0-9.el9 epel 4.4 M
libarrow-doc noarch 9.0.0-9.el9 epel 24 k
libbabeltrace x86_64 1.5.8-10.el9 appstream 190 k
libcephfs2 x86_64 2:18.2.0-1.el9s centos-ceph-reef 638 k
libicu x86_64 67.1-9.el9 baseos 9.6 M
liboath x86_64 2.6.7-2.el9 epel 49 k
libpmem x86_64 1.12.1-1.el9 appstream 112 k
libpmemobj x86_64 1.12.1-1.el9 appstream 160 k
librabbitmq x86_64 0.11.0-7.el9 appstream 45 k
librados2 x86_64 2:18.2.0-1.el9s centos-ceph-reef 3.2 M
libradosstriper1 x86_64 2:18.2.0-1.el9s centos-ceph-reef 459 k
librbd1 x86_64 2:18.2.0-1.el9s centos-ceph-reef 2.9 M
librdkafka x86_64 1.6.1-102.el9 appstream 662 k
librdmacm x86_64 46.0-1.el9 baseos 71 k
librgw2 x86_64 2:18.2.0-1.el9s centos-ceph-reef 4.4 M
libunwind x86_64 1.6.2-1.el9 epel 67 k
liburing x86_64 2.3-2.el9 appstream 27 k
lttng-ust x86_64 2.12.0-6.el9 appstream 292 k
mailcap noarch 2.1.49-5.el9 baseos 33 k
ndctl-libs x86_64 71.1-8.el9 baseos 89 k
parquet-libs x86_64 9.0.0-9.el9 epel 837 k
python3-ceph-argparse x86_64 2:18.2.0-1.el9s centos-ceph-reef 47 k
python3-ceph-common x86_64 2:18.2.0-1.el9s centos-ceph-reef 122 k
python3-cephfs x86_64 2:18.2.0-1.el9s centos-ceph-reef 158 k
python3-prettytable noarch 0.7.2-27.el9 appstream 42 k
python3-pyyaml x86_64 5.4.1-6.el9 baseos 205 k
python3-rados x86_64 2:18.2.0-1.el9s centos-ceph-reef 321 k
python3-rbd x86_64 2:18.2.0-1.el9s centos-ceph-reef 300 k
python3-rgw x86_64 2:18.2.0-1.el9s centos-ceph-reef 101 k
re2 x86_64 1:20211101-3.el9 epel 192 k
thrift x86_64 0.15.0-2.el9 epel 1.6 M
Installing weak dependencies:
smartmontools x86_64 1:7.2-7.el9 baseos 554 k
Transaction Summary
================================================================================
Install 40 Packages
Total download size: 62 M
Installed size: 232 M
Downloading Packages:
(1/40): ceph-radosgw-18.2.0-1.el9s.x86_64.rpm 1.2 MB/s | 7.1 MB 00:05
(2/40): ceph-selinux-18.2.0-1.el9s.x86_64.rpm 257 kB/s | 26 kB 00:00
(3/40): libcephfs2-18.2.0-1.el9s.x86_64.rpm 1.2 MB/s | 638 kB 00:00
(4/40): ceph-base-18.2.0-1.el9s.x86_64.rpm 766 kB/s | 4.9 MB 00:06
(5/40): libradosstriper1-18.2.0-1.el9s.x86_64.r 726 kB/s | 459 kB 00:00
(6/40): librados2-18.2.0-1.el9s.x86_64.rpm 1.7 MB/s | 3.2 MB 00:01
(7/40): librgw2-18.2.0-1.el9s.x86_64.rpm 2.5 MB/s | 4.4 MB 00:01
(8/40): python3-ceph-argparse-18.2.0-1.el9s.x86 686 kB/s | 47 kB 00:00
(9/40): python3-ceph-common-18.2.0-1.el9s.x86_6 1.5 MB/s | 122 kB 00:00
(10/40): python3-cephfs-18.2.0-1.el9s.x86_64.rp 1.2 MB/s | 158 kB 00:00
(11/40): librbd1-18.2.0-1.el9s.x86_64.rpm 929 kB/s | 2.9 MB 00:03
(12/40): python3-rados-18.2.0-1.el9s.x86_64.rpm 2.1 MB/s | 321 kB 00:00
(13/40): python3-rgw-18.2.0-1.el9s.x86_64.rpm 1.4 MB/s | 101 kB 00:00
(14/40): daxctl-libs-71.1-8.el9.x86_64.rpm 393 kB/s | 42 kB 00:00
(15/40): python3-rbd-18.2.0-1.el9s.x86_64.rpm 1.3 MB/s | 300 kB 00:00
(16/40): librdmacm-46.0-1.el9.x86_64.rpm 773 kB/s | 71 kB 00:00
(17/40): mailcap-2.1.49-5.el9.noarch.rpm 199 kB/s | 33 kB 00:00
(18/40): ndctl-libs-71.1-8.el9.x86_64.rpm 449 kB/s | 89 kB 00:00
(19/40): python3-pyyaml-5.4.1-6.el9.x86_64.rpm 1.0 MB/s | 205 kB 00:00
(20/40): smartmontools-7.2-7.el9.x86_64.rpm 1.1 MB/s | 554 kB 00:00
(21/40): boost-program-options-1.75.0-8.el9.x86 858 kB/s | 107 kB 00:00
(22/40): libbabeltrace-1.5.8-10.el9.x86_64.rpm 788 kB/s | 190 kB 00:00
(23/40): libpmem-1.12.1-1.el9.x86_64.rpm 336 kB/s | 112 kB 00:00
(24/40): libpmemobj-1.12.1-1.el9.x86_64.rpm 304 kB/s | 160 kB 00:00
(25/40): librabbitmq-0.11.0-7.el9.x86_64.rpm 203 kB/s | 45 kB 00:00
(26/40): librdkafka-1.6.1-102.el9.x86_64.rpm 924 kB/s | 662 kB 00:00
(27/40): liburing-2.3-2.el9.x86_64.rpm 161 kB/s | 27 kB 00:00
(28/40): libicu-67.1-9.el9.x86_64.rpm 2.4 MB/s | 9.6 MB 00:03
(29/40): lttng-ust-2.12.0-6.el9.x86_64.rpm 667 kB/s | 292 kB 00:00
(30/40): python3-prettytable-0.7.2-27.el9.noarc 765 kB/s | 42 kB 00:00
(31/40): fmt-8.1.1-5.el9.x86_64.rpm 146 kB/s | 111 kB 00:00
(32/40): gperftools-libs-2.9.1-2.el9.x86_64.rpm 423 kB/s | 309 kB 00:00
(33/40): libarrow-doc-9.0.0-9.el9.noarch.rpm 52 kB/s | 24 kB 00:00
(34/40): liboath-2.6.7-2.el9.x86_64.rpm 64 kB/s | 49 kB 00:00
(35/40): libarrow-9.0.0-9.el9.x86_64.rpm 3.3 MB/s | 4.4 MB 00:01
(36/40): libunwind-1.6.2-1.el9.x86_64.rpm 666 kB/s | 67 kB 00:00
(37/40): parquet-libs-9.0.0-9.el9.x86_64.rpm 2.9 MB/s | 837 kB 00:00
(38/40): re2-20211101-3.el9.x86_64.rpm 636 kB/s | 192 kB 00:00
(39/40): thrift-0.15.0-2.el9.x86_64.rpm 4.0 MB/s | 1.6 MB 00:00
(40/40): ceph-common-18.2.0-1.el9s.x86_64.rpm 844 kB/s | 18 MB 00:21
--------------------------------------------------------------------------------
Total 2.4 MB/s | 62 MB 00:26
CentOS Stream 9 - BaseOS 44 kB/s | 1.6 kB 00:00
Importing GPG key 0x8483C65D:
Userid : "CentOS (CentOS Official Signing Key) "
Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Extra Packages for Enterprise Linux 9 - x86_64 1.6 MB/s | 1.6 kB 00:00
Importing GPG key 0x3228467C:
Userid : "Fedora (epel9) "
Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : lttng-ust-2.12.0-6.el9.x86_64 1/40
Installing : librdkafka-1.6.1-102.el9.x86_64 2/40
Installing : librabbitmq-0.11.0-7.el9.x86_64 3/40
Installing : libicu-67.1-9.el9.x86_64 4/40
Installing : daxctl-libs-71.1-8.el9.x86_64 5/40
Installing : ndctl-libs-71.1-8.el9.x86_64 6/40
Installing : thrift-0.15.0-2.el9.x86_64 7/40
Installing : liboath-2.6.7-2.el9.x86_64 8/40
Installing : liburing-2.3-2.el9.x86_64 9/40
Installing : python3-ceph-argparse-2:18.2.0-1.el9s.x86_64 10/40
Installing : libpmem-1.12.1-1.el9.x86_64 11/40
Installing : libpmemobj-1.12.1-1.el9.x86_64 12/40
Installing : re2-1:20211101-3.el9.x86_64 13/40
Installing : libarrow-9.0.0-9.el9.x86_64 14/40
Installing : libunwind-1.6.2-1.el9.x86_64 15/40
Installing : gperftools-libs-2.9.1-2.el9.x86_64 16/40
Installing : libarrow-doc-9.0.0-9.el9.noarch 17/40
Installing : fmt-8.1.1-5.el9.x86_64 18/40
Installing : python3-prettytable-0.7.2-27.el9.noarch 19/40
Installing : libbabeltrace-1.5.8-10.el9.x86_64 20/40
Installing : boost-program-options-1.75.0-8.el9.x86_64 21/40
Installing : parquet-libs-9.0.0-9.el9.x86_64 22/40
Installing : smartmontools-1:7.2-7.el9.x86_64 23/40
Running scriptlet: smartmontools-1:7.2-7.el9.x86_64 23/40
Created symlink /etc/systemd/system/multi-user.target.wants/smartd.service → /usr/lib/systemd/system/smartd.service.
Installing : python3-pyyaml-5.4.1-6.el9.x86_64 24/40
Installing : python3-ceph-common-2:18.2.0-1.el9s.x86_64 25/40
Installing : mailcap-2.1.49-5.el9.noarch 26/40
Installing : librdmacm-46.0-1.el9.x86_64 27/40
Installing : librados2-2:18.2.0-1.el9s.x86_64 28/40
Running scriptlet: librados2-2:18.2.0-1.el9s.x86_64 28/40
Installing : python3-rados-2:18.2.0-1.el9s.x86_64 29/40
Installing : libcephfs2-2:18.2.0-1.el9s.x86_64 30/40
Running scriptlet: libcephfs2-2:18.2.0-1.el9s.x86_64 30/40
Installing : librbd1-2:18.2.0-1.el9s.x86_64 31/40
Running scriptlet: librbd1-2:18.2.0-1.el9s.x86_64 31/40
Installing : librgw2-2:18.2.0-1.el9s.x86_64 32/40
Running scriptlet: librgw2-2:18.2.0-1.el9s.x86_64 32/40
Installing : python3-rgw-2:18.2.0-1.el9s.x86_64 33/40
Installing : python3-rbd-2:18.2.0-1.el9s.x86_64 34/40
Installing : python3-cephfs-2:18.2.0-1.el9s.x86_64 35/40
Installing : libradosstriper1-2:18.2.0-1.el9s.x86_64 36/40
Running scriptlet: libradosstriper1-2:18.2.0-1.el9s.x86_64 36/40
Running scriptlet: ceph-common-2:18.2.0-1.el9s.x86_64 37/40
Installing : ceph-common-2:18.2.0-1.el9s.x86_64 37/40
Running scriptlet: ceph-common-2:18.2.0-1.el9s.x86_64 37/40
Installing : ceph-base-2:18.2.0-1.el9s.x86_64 38/40
Running scriptlet: ceph-base-2:18.2.0-1.el9s.x86_64 38/40
Created symlink /etc/systemd/system/multi-user.target.wants/ceph.target → /usr/lib/systemd/system/ceph.target.
Created symlink /etc/systemd/system/ceph.target.wants/ceph-crash.service → /usr/lib/systemd/system/ceph-crash.service.
Installing : ceph-selinux-2:18.2.0-1.el9s.x86_64 39/40
Running scriptlet: ceph-selinux-2:18.2.0-1.el9s.x86_64 39/40
skipping the directory /sys
skipping the directory /proc
skipping the directory /mnt
skipping the directory /var/tmp
skipping the directory /home
skipping the directory /root
skipping the directory /tmp
Installing : ceph-radosgw-2:18.2.0-1.el9s.x86_64 40/40
Running scriptlet: ceph-radosgw-2:18.2.0-1.el9s.x86_64 40/40
Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "ceph-radosgw@*.service" escaped as "ceph-radosgw@x2a.service".
Created symlink /etc/systemd/system/multi-user.target.wants/ceph-radosgw.target → /usr/lib/systemd/system/ceph-radosgw.target.
Created symlink /etc/systemd/system/ceph.target.wants/ceph-radosgw.target → /usr/lib/systemd/system/ceph-radosgw.target.
Verifying : ceph-base-2:18.2.0-1.el9s.x86_64 1/40
Verifying : ceph-common-2:18.2.0-1.el9s.x86_64 2/40
Verifying : ceph-radosgw-2:18.2.0-1.el9s.x86_64 3/40
Verifying : ceph-selinux-2:18.2.0-1.el9s.x86_64 4/40
Verifying : libcephfs2-2:18.2.0-1.el9s.x86_64 5/40
Verifying : librados2-2:18.2.0-1.el9s.x86_64 6/40
Verifying : libradosstriper1-2:18.2.0-1.el9s.x86_64 7/40
Verifying : librbd1-2:18.2.0-1.el9s.x86_64 8/40
Verifying : librgw2-2:18.2.0-1.el9s.x86_64 9/40
Verifying : python3-ceph-argparse-2:18.2.0-1.el9s.x86_64 10/40
Verifying : python3-ceph-common-2:18.2.0-1.el9s.x86_64 11/40
Verifying : python3-cephfs-2:18.2.0-1.el9s.x86_64 12/40
Verifying : python3-rados-2:18.2.0-1.el9s.x86_64 13/40
Verifying : python3-rbd-2:18.2.0-1.el9s.x86_64 14/40
Verifying : python3-rgw-2:18.2.0-1.el9s.x86_64 15/40
Verifying : daxctl-libs-71.1-8.el9.x86_64 16/40
Verifying : libicu-67.1-9.el9.x86_64 17/40
Verifying : librdmacm-46.0-1.el9.x86_64 18/40
Verifying : mailcap-2.1.49-5.el9.noarch 19/40
Verifying : ndctl-libs-71.1-8.el9.x86_64 20/40
Verifying : python3-pyyaml-5.4.1-6.el9.x86_64 21/40
Verifying : smartmontools-1:7.2-7.el9.x86_64 22/40
Verifying : boost-program-options-1.75.0-8.el9.x86_64 23/40
Verifying : libbabeltrace-1.5.8-10.el9.x86_64 24/40
Verifying : libpmem-1.12.1-1.el9.x86_64 25/40
Verifying : libpmemobj-1.12.1-1.el9.x86_64 26/40
Verifying : librabbitmq-0.11.0-7.el9.x86_64 27/40
Verifying : librdkafka-1.6.1-102.el9.x86_64 28/40
Verifying : liburing-2.3-2.el9.x86_64 29/40
Verifying : lttng-ust-2.12.0-6.el9.x86_64 30/40
Verifying : python3-prettytable-0.7.2-27.el9.noarch 31/40
Verifying : fmt-8.1.1-5.el9.x86_64 32/40
Verifying : gperftools-libs-2.9.1-2.el9.x86_64 33/40
Verifying : libarrow-9.0.0-9.el9.x86_64 34/40
Verifying : libarrow-doc-9.0.0-9.el9.noarch 35/40
Verifying : liboath-2.6.7-2.el9.x86_64 36/40
Verifying : libunwind-1.6.2-1.el9.x86_64 37/40
Verifying : parquet-libs-9.0.0-9.el9.x86_64 38/40
Verifying : re2-1:20211101-3.el9.x86_64 39/40
Verifying : thrift-0.15.0-2.el9.x86_64 40/40
Installed:
boost-program-options-1.75.0-8.el9.x86_64
ceph-base-2:18.2.0-1.el9s.x86_64
ceph-common-2:18.2.0-1.el9s.x86_64
ceph-radosgw-2:18.2.0-1.el9s.x86_64
ceph-selinux-2:18.2.0-1.el9s.x86_64
daxctl-libs-71.1-8.el9.x86_64
fmt-8.1.1-5.el9.x86_64
gperftools-libs-2.9.1-2.el9.x86_64
libarrow-9.0.0-9.el9.x86_64
libarrow-doc-9.0.0-9.el9.noarch
libbabeltrace-1.5.8-10.el9.x86_64
libcephfs2-2:18.2.0-1.el9s.x86_64
libicu-67.1-9.el9.x86_64
liboath-2.6.7-2.el9.x86_64
libpmem-1.12.1-1.el9.x86_64
libpmemobj-1.12.1-1.el9.x86_64
librabbitmq-0.11.0-7.el9.x86_64
librados2-2:18.2.0-1.el9s.x86_64
libradosstriper1-2:18.2.0-1.el9s.x86_64
librbd1-2:18.2.0-1.el9s.x86_64
librdkafka-1.6.1-102.el9.x86_64
librdmacm-46.0-1.el9.x86_64
librgw2-2:18.2.0-1.el9s.x86_64
libunwind-1.6.2-1.el9.x86_64
liburing-2.3-2.el9.x86_64
lttng-ust-2.12.0-6.el9.x86_64
mailcap-2.1.49-5.el9.noarch
ndctl-libs-71.1-8.el9.x86_64
parquet-libs-9.0.0-9.el9.x86_64
python3-ceph-argparse-2:18.2.0-1.el9s.x86_64
python3-ceph-common-2:18.2.0-1.el9s.x86_64
python3-cephfs-2:18.2.0-1.el9s.x86_64
python3-prettytable-0.7.2-27.el9.noarch
python3-pyyaml-5.4.1-6.el9.x86_64
python3-rados-2:18.2.0-1.el9s.x86_64
python3-rbd-2:18.2.0-1.el9s.x86_64
python3-rgw-2:18.2.0-1.el9s.x86_64
re2-1:20211101-3.el9.x86_64
smartmontools-1:7.2-7.el9.x86_64
thrift-0.15.0-2.el9.x86_64
Complete!
[root@node01 ~]#
3.更新ceph.conf文件
[root@node01 ~]# vi /etc/ceph/ceph.conf
[root@node01 ~]# cat /etc/ceph/ceph.conf
[global]
# specify cluster network for monitoring
cluster network = 192.168.10.0/24
# specify public network
public network = 192.168.10.0/24
# specify UUID genarated above
fsid = 1293692e-ff54-43d7-a6b2-f96d82d2a6ac
# specify IP address of Monitor Daemon
mon host = 192.168.10.101
# specify Hostname of Monitor Daemon
mon initial members = node01
osd pool default crush rule = -1
# mon.(Node name)
[mon.node01]
# specify Hostname of Monitor Daemon
host = node01
# specify IP address of Monitor Daemon
mon addr = 192.168.10.101
# allow to delete pools
mon allow pool delete = true
# add to the end
# client.rgw.(Node Name)
[client.rgw.www]
# IP address of the Node
host = 192.168.10.140
# DNS name
rgw dns name = www.srv.world
keyring = /var/lib/ceph/radosgw/ceph-rgw.www/keyring
log file = /var/log/ceph/radosgw.gateway.log
[root@node01 ~]#
4.同步ceph所需的文件至RADOSGW主机
[root@node01 ~]# scp /etc/ceph/ceph.conf www:/etc/ceph/
ceph.conf 100% 826 345.7KB/s 00:00
[root@node01 ~]# scp /etc/ceph/ceph.client.admin.keyring www:/etc/ceph/
ceph.client.admin.keyring 100% 151 201.0KB/s 00:00
[root@node01 ~]#
5.配置RADOSGW
[root@node01 ~]# ssh www
"mkdir -p /var/lib/ceph/radosgw/ceph-rgw.www;
ceph auth get-or-create client.rgw.www osd 'allow rwx' mon 'allow rw' -o /var/lib/ceph/radosgw/ceph-rgw.www/keyring;
chown ceph:ceph /etc/ceph/ceph.*;
chown -R ceph:ceph /var/lib/ceph/radosgw;
systemctl enable --now ceph-radosgw@rgw.www;
firewall-cmd --add-port=7480/tcp; firewall-cmd --runtime-to-permanent"
Created symlink /etc/systemd/system/ceph-radosgw.target.wants/ceph-radosgw@rgw.www.service → /usr/lib/systemd/system/ceph-radosgw@.service.
success
success
6.确认RADOSGW状态
[root@node01 ~]# curl www.srv.world:7480
anonymous[root@node01 ~]#
7.在RADOSGW主机,创建可向对象网关进行身份验证的 S3 兼容用户
[root@www ~]# radosgw-admin user create --uid=serverworld --display-name="Server World" --email=admin@srv.world
{
"user_id": "serverworld",
"display_name": "Server World",
"email": "admin@srv.world",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "serverworld",
"access_key": "GCUWMAR40MKGB8EKJ9WQ",
"secret_key": "vEWP1XO1WN3HFxxE1rLIMSOcL2PPUBxNevE6HzeD"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"default_storage_class": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
[root@www ~]#
查看用户属性
[root@www ~]# radosgw-admin user list
[
"serverworld"
]
[root@www ~]# radosgw-admin user info --uid=serverworld
{
"user_id": "serverworld",
"display_name": "Server World",
"email": "admin@srv.world",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "serverworld",
"access_key": "GCUWMAR40MKGB8EKJ9WQ",
"secret_key": "vEWP1XO1WN3HFxxE1rLIMSOcL2PPUBxNevE6HzeD"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"default_storage_class": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
[root@www ~]#
验证使用 S3 接口的访问,以在具有普通用户的计算机上创建 Python 测试脚本。在dlp操作如下:
[root@dlp ~]# pip3 install boto3
Collecting boto3
Downloading boto3-1.28.45-py3-none-any.whl (135 kB)
|████████████████████████████████| 135 kB 142 kB/s
Collecting s3transfer=0.6.0
Downloading s3transfer-0.6.2-py3-none-any.whl (79 kB)
|████████████████████████████████| 79 kB 248 kB/s
Collecting botocore=1.31.45
Downloading botocore-1.31.45-py3-none-any.whl (11.2 MB)
|████████████████████████████████| 11.2 MB 213 kB/s
Collecting jmespath=0.7.1
Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)
Collecting urllib3=1.25.4
Downloading urllib3-1.26.16-py2.py3-none-any.whl (143 kB)
|████████████████████████████████| 143 kB 330 kB/s
Requirement already satisfied: python-dateutil=2.1 in /usr/lib/python3.9/site-packages (from botocore=1.31.45->boto3) (2.8.1)
Requirement already satisfied: six>=1.5 in /usr/lib/python3.9/site-packages (from python-dateutil=2.1->botocore=1.31.45->boto3) (1.15.0)
Installing collected packages: urllib3, jmespath, botocore, s3transfer, boto3
Successfully installed boto3-1.28.45 botocore-1.31.45 jmespath-1.0.1 s3transfer-0.6.2 urllib3-1.26.16
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
创建测试脚本
[root@dlp ~]# vi s3_test.py
[root@dlp ~]# cat s3_test.py
import sys
import boto3
from botocore.config import Config
# user's access-key and secret-key you added on [2] section
session = boto3.session.Session(
aws_access_key_id = 'GCUWMAR40MKGB8EKJ9WQ',
aws_secret_access_key = 'vEWP1XO1WN3HFxxE1rLIMSOcL2PPUBxNevE6HzeD'
)
# Object Gateway URL
s3client = session.client(
's3',
endpoint_url = 'http://192.168.10.140:7480',
config = Config()
)
# create [my-new-bucket]
bucket = s3client.create_bucket(Bucket = 'my-new-bucket')
# list Buckets
print(s3client.list_buckets())
# remove [my-new-bucket]
s3client.delete_bucket(Bucket = 'my-new-bucket')
[root@dlp ~]#
脚本验证
[root@dlp ~]# python3 s3_test.py
{'ResponseMetadata': {'RequestId': 'tx00000507c7d1c780318e4-0065006080-379f-default', 'HostId': '', 'HTTPStatusCode': 200, 'HTTPHeaders': {'transfer-encoding': 'chunked', 'x-amz-request-id': 'tx00000507c7d1c780318e4-0065006080-379f-default', 'content-type': 'application/xml', 'date': 'Tue, 12 Sep 2023 12:58:40 GMT', 'connection': 'Keep-Alive'}, 'RetryAttempts': 0}, 'Buckets': [{'Name': 'my-new-bucket', 'CreationDate': datetime.datetime(2023, 9, 12, 12, 58, 36, 670000, tzinfo=tzutc())}], 'Owner': {'DisplayName': 'Server World', 'ID': 'serverworld'}}
[root@dlp ~]#
下一小节将为大家介绍启用Dashboard,欢迎关注!