Skip to content

Commit dec972f

Browse files
committed
rados gw
1 parent 58db617 commit dec972f

4 files changed

+153
-9
lines changed
57.1 KB
Loading
44.2 KB
Loading

Ceph/PIC/ceph-radosgw-lab.xml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<mxfile userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36" version="8.3.4" editor="www.draw.io" type="device"><diagram id="4cf90dc6-6bb1-a75f-946d-dfb10c2198e1" name="Page-1">7Vtdc6M2FP01nuk+hEEfSOgxzm7ah21np+lMdx+xUWwmGLkYr53++oog2YAAKzE4ZhrPZAxXQoJ7zr26R8QTdLfa/5oG6+XvIuTxBLrhfoI+TyAELiTyK7c8FxaMvMKwSKNQdToaHqJ/ub5SWbdRyDeVjpkQcRatq8a5SBI+zyq2IE3FrtrtUcTVWdfBghuGh3kQm9a/ozBbFlYf0qP9Nx4tlnpmQFjRMgvmT4tUbBM13wSix5dP0bwK9FjqQTfLIBS7kgl9maC7VIisOFrt73ic+1a7rbjuvqX1cN8pTzKbC2Bxwc8g3qpHv+PrpbT8Ke9rs9jJo6/BTN1r9qz9k/G9HH66zFaxNAB5uMlS8cTvRCxSaUlEIntOH6M4rpmCOFok8nQub5BL+/QnT7NIev5WNayiMMynme6WUcYf1sE8n3MneSZtL57l+b27+fAiyR7UTQF9XnAJePJcPZucgO9b/QMOXpds5mLFs/RZdlEXYKKAUkRm6nR3ZAVylW1ZYgRStkARcXEY+QiGPFB4NGODDGwMHHgS3uZ0P/q3BEnZHbjmLrcJiryDhksS9/7elZ8ajEdC1zEvX1G06NBBByx4aMTdSSRKrvYaPK1tKY+DLPpZHb7J/WqGbyKSEx+ARrgKNCA1BDdim865uqocUbWBfHJioCxIFzwzBnphw+GxrQiCDYJ8287iaC5tf/BsJ9Knaw5cxUzYQbweAvgQnRoOZEYwgA28gj1EsGcABBh0APEd6Mjh7zWCVw0Q7soM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ykzp4aUKc2SZ4x5kdkfasUbNIo5Hq7Pa/P7c6c530FnA/BeOo9CCH0Lr9ULrBPTULMmHUlrQXCY+lFZrVday2o1AaVnswY5fabXAc7GiuaeXVlejs8xdmLNJc206670pU9VZFaBHILMsfh8ztMyibb8auYTIQtb/KniWyEKd1cL1iCxk7ud9iKwyU65SZCGL2mC0IqvN71cnspD5Yniei6wNMiXS7Xr9/9RNJ9C8oG7CFttrY6+NWpadj9qogSDy9PiT8aL78Xf56Mt/</diagram></mxfile>

Ceph/ceph-radosgw-install.md

+152-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# Triển khai Radosgw trên Ceph Cluster
22
---
33
## Chuẩn bị
4-
Đọc các tài liệu
5-
Sử dụng lab 3 node ceph
4+
### Sơ đồ
5+
![](PIC/ceph-radosgw-install-sodo.png)
6+
### Tài nguyên
7+
__Yều cầu 3 node chạy ceph, 1 node giả lập app sử dụng s3 API__
8+
![](PIC/ceph-radosgw-install-struc.png)
9+
> Tất cả chạy CentOS 7
610
711
## Cài đặt
8-
### Phần 1: Thiết lập Ceph Radosgw
12+
### Phần 1: Cài đặt Ceph
13+
[Cài đặt Ceph theo Lab 3 node](ceph-3node-lab.md)
14+
15+
> Thiết lập IP theo lab hiện tại
16+
17+
### Phần 2: Thiết lập Ceph Radosgw
18+
> Thực hiện trên __ceph-admin__
19+
920
#### Bước 1: Thiết lập tại ceph-admin (Node có quyền admin)
10-
> Thực hiện trên ceph-admin
1121

1222
Truy cập ceph-admin
1323
```
@@ -35,7 +45,9 @@ __Kết quả__
3545

3646
pic 1
3747

38-
### Phần 2: Tạo radosgw user
48+
### Phần 3: Tạo radosgw user
49+
> Thực hiện trên __ceph-admin__
50+
3951
#### Tổng quát
4052
Để có thể sử dụng Ceph object storage, ta cần tạo user truy cập Radosgw. User được định danh bằng access và secret key, sử dụng cho mục đích truy cập, thực hiện các hoạt động trên Ceph object storage.
4153

@@ -118,8 +130,8 @@ ssh root@ceph-admin
118130
"temp_url_keys": []
119131
}
120132
```
121-
### Phần 3: Kiểm tra user cung cấp bởi Radosgw
122-
> Thực hiện trên ceph-admin (có thể trên ceph-client)
133+
### Phần 4: Kiểm tra user cung cấp bởi Radosgw
134+
> Thực hiện trên __ceph-admin__ (có thể trên ceph-client)
123135
124136
__Cài đặt gói__
125137
```
@@ -173,7 +185,138 @@ __Xóa bucket test__
173185
radosgw-admin bucket rm my-new-bucket
174186
```
175187

176-
### Phần 3: Truy cập Ceph object storage
188+
### Phần 5: Truy cập Ceph object storage thông qua s3 interface
177189
Ở đây sẽ truy cập Ceph object thông qua S3 API tương thích.
190+
> Thực hiện các bước sau tại __ceph-s3 node__
191+
192+
#### Thiết lập file host
193+
Thiết lập file host trên ceph-s3 node
194+
```
195+
[root@ceph-s3 ~]# vim /etc/hosts
196+
```
197+
Nội dung
198+
```
199+
192.168.2.136 ceph-admin
200+
201+
192.168.2.137 ceph-node-1 cephgw.test.lab
202+
203+
192.168.2.138 ceph-node-2
204+
205+
192.168.2.144 ceph-s3
206+
```
207+
#### Bước 1: Cài đặt s3cmd
208+
```
209+
yum install epel-release -y
210+
yum install python-pip -y
211+
pip install s3cmd
212+
```
213+
214+
Kiểm tra version s3cmd
215+
```
216+
[root@ceph-s3 ~]# s3cmd --version
217+
s3cmd version 2.0.1
218+
```
219+
220+
#### Bước 2: Thiết lập kết nối s3cmd với Ceph thông qua S3 API
221+
> Sử dụng user vừa tạo tại phần 2 để truy cập Radosgw
222+
223+
```
224+
[root@ceph-s3 ~]# s3cmd --configure
225+
226+
Enter new values or accept defaults in brackets with Enter.
227+
Refer to user manual for detailed description of all options.
228+
229+
Access key and Secret key are your identifiers for Amazon S3. Leave them empty for using the env variables.
230+
Access Key [UDW5NH3UZ83CK1W0U2PW]:
231+
Secret Key [BjPiwiRRdTmgK50SjeDCmgVgfNWjfPgTIRTTr4Zq]:
232+
Default Region [US]:
233+
234+
Use "s3.amazonaws.com" for S3 Endpoint and not modify it to the target Amazon S3.
235+
S3 Endpoint [cephgw.test.lab:7480]:
236+
237+
Use "%(bucket)s.s3.amazonaws.com" to the target Amazon S3. "%(bucket)s" and "%(location)s" vars can be used
238+
if the target S3 system supports dns based buckets.
239+
DNS-style bucket+hostname:port template for accessing a bucket [cephgw.test.lab:7480]: cephgw.test.lab:7480
240+
241+
Encryption password is used to protect your files from reading
242+
by unauthorized persons while in transfer to S3
243+
Encryption password [thanh]:
244+
Path to GPG program [/bin/gpg]:
245+
246+
When using secure HTTPS protocol all communication with Amazon S3
247+
servers is protected from 3rd party eavesdropping. This method is
248+
slower than plain HTTP, and can only be proxied with Python 2.7 or newer
249+
Use HTTPS protocol [No]: No
250+
251+
On some networks all internet access must go through a HTTP proxy.
252+
Try setting it here if you can't connect to S3 directly
253+
HTTP Proxy server name:
254+
255+
New settings:
256+
Access Key: UDW5NH3UZ83CK1W0U2PW
257+
Secret Key: BjPiwiRRdTmgK50SjeDCmgVgfNWjfPgTIRTTr4Zq
258+
Default Region: US
259+
S3 Endpoint: cephgw.test.lab:7480
260+
DNS-style bucket+hostname:port template for accessing a bucket: cephgw.test.lab:7480
261+
Encryption password: thanh
262+
Path to GPG program: /bin/gpg
263+
Use HTTPS protocol: False
264+
HTTP Proxy server name:
265+
HTTP Proxy server port: 0
266+
267+
Test access with supplied credentials? [Y/n] y
268+
Please wait, attempting to list all buckets...
269+
Success. Your access key and secret key worked fine :-)
270+
271+
Now verifying that encryption works...
272+
Success. Encryption and decryption worked fine :-)
273+
274+
Save settings? [y/N] y
275+
Configuration saved to '/root/.s3cfg'
276+
```
277+
> Kết nối s3 API thành công với Ceph Radosgw
278+
279+
> Lưu ý cả thiết lập: Access Key, Secret Key, S3 Endpoint, S3 system supports dns based buckets, Use HTTPS protocol [No]: No
280+
__Tạo bucket thông qua s3 cmd__
281+
282+
```
283+
[root@ceph-s3 ~]# s3cmd ls
284+
[root@ceph-s3 ~]# s3cmd mb s3://first-bucket
285+
Bucket 's3://first-bucket/' created
286+
[root@ceph-s3 ~]# s3cmd put /etc/hosts s3://first-bucket
287+
upload: '/etc/hosts' -> 's3://first-bucket/hosts' [1 of 1]
288+
287 of 287 100% in 1s 149.55 B/s done
289+
```
290+
291+
### Phần 6: Kiểm chứng
292+
#### Kiểm tra tại Ceph storage cluste
293+
> Thực hiện tại node có quyền admin trong ceph
294+
295+
Kiểm tra bucket vừa tạo thông qua s3 interface tại ceph-s3 node
296+
```
297+
[root@ceph-admin cluster]# radosgw-admin bucket list --bucket=first-bucket
298+
[
299+
{
300+
"name": "hosts",
301+
"instance": "",
302+
"namespace": "",
303+
"owner": "lacoski",
304+
"owner_display_name": "my user lacoski",
305+
"size": 287,
306+
"mtime": "2018-03-01 06:54:26.738998Z",
307+
"etag": "4913007553cb4d9f13babc6cec275407",
308+
"content_type": "text\/plain",
309+
"tag": "f0332421-32af-4fc3-8a3e-c55a5b365b60.84105.9",
310+
"flags": 0,
311+
"user_data": ""
312+
}
313+
]
314+
```
315+
> The Ceph Object Gateway supports a subset of the Amazon S3 policy language applied to buckets. [Link](http://docs.ceph.com/docs/master/radosgw/bucketpolicy/)
178316
179-
####
317+
## Nguồn
318+
http://docs.ceph.com/docs/master/radosgw/bucketpolicy/#
319+
http://s3tools.org/usage
320+
http://s3tools.org/s3cmd
321+
http://s3tools.org/s3cmd-howto
322+
https://linuxconfig.org/getting-started-with-aws-s3cmd-command-by-examples

0 commit comments

Comments
 (0)