Thứ Tư, 10 tháng 5, 2017

Cài đặt tính năng S3 Object storage cho Virtuozzo 6.0

Tính năng S3 Object Storage bao gồm các role sau:

Object server: lưu trữ dữ liệu được nhận từ S3 gateway. Dữ liệu thực chất được lưu trên virtuozzo storage để bảo đảm tính HA
Name server: lưu thông tin metada của bucket bao gồm object name, ACL, dung lượng, vị trí, người sở hữu. Dữ liệu thực chất được lưu trên virtuozzo storage để bảo đảm tính HA
S3 gateway: đóng vai trò là proxy giữa người dùng cuối và các máy chủ object. Nó nhận và xử lý các yêu cầu bằng giao thức Amazon S3 và sử dụng nginx Web server cho các kết nối từ bên ngoài. S3 gateway quản lý việc chứng thực tài khoản user và kiểm tra phân quyền ACL checks. Bản thân nó không sinh ra dữ liệu
Block level: là virtuozzo storage

Với bài lab này ta triển khai cài đặt 3 role Object Server, Name Server và S3 gateway trên 3 hardware node đang chạy thuộc cụm Virtuozzo 6.0 với thông tin 3 node như sau

Server name: rs00360 - Storage IP: 172.16.10.24 - WAN IP: 103.199.9.24
Server name: rs00361 - Storage IP: 172.16.10.25 - WAN IP: 103.199.9.25
Server name: rs00362 - Storage IP: 172.16.10.26 - WAN IP: 103.199.9.26

Cài đặt Object Server

Bước 1 (thực hiện trên cả 3 node): 
add thông tin vào file /etc/hosts để phân giải hostname ra IP storage

172.16.10.24 rs00360 rs00360.dinodata.vn
172.16.10.25 rs00361 rs00361.dinodata.vn
172.16.10.26 rs00362 rs00362.dinodata.vn

Bước 2 (thực hiện trên cả 3 node): cài đặt gói pstorage-ostor

Code:
# yum install pstorage-ostor
Bước 3 (thực hiện trên 1 node sẽ chạy role object server) : Tạo configure service mới và chỉ định số lượng máy chủ sẽ làm object server và name server

Code:
ostor-ctl create -n <hostname> -r /var/lib/ostor/configuration -c 
"pstorage://<cluster_name>/<ostor_dir> 4 5"
<hostname> là tên node đang tiến hành tạo configure service
<cluster_name> là tên cluster của virtuozzo 6.0
<ostor_dir> là thư mục chứa các tập tin của dịch vụ object storage
4 là số lượng node sẽ cài name server
5 là số lượng node sẽ cài storage object

Bước này hệ thống sẽ yêu cầu đặt mật khẩu

Trong bài này ta gõ lệnh sau:
Code:
ostor-ctl create -n rs00360 -r /var/lib/ostor/configuration -c "pstorage://minicloudt9/s3-t9 3 3"
Bước 4: khởi động configure service

Code:
# service ostor-cfgd start
# chkconfig ostor-cfgd on
Bước 5 (thực hiện trên 1 node sẽ chạy role object server): Khởi tạo kho lưu trữ object storage
Code:
ostor-ctl init-storage -n <hostname> -s <cluster_mount_point>
Thư mục <ostor_dir> đã qui định ở bước 3 sẽ được tạo tại bước này. Đồng thời bạn cần nhập mật khẩu đã đặt ở bước 3

Trong bài này ta gõ lệnh sau:
Code:
ostor-ctl init-storage -n rs00361 -s /pstorage/minicloudt9

Bước 6 (
thực hiện trên các node sẽ chạy role object server): thêm các host vào cụm

Code:
# ostor-ctl add-host -r <cluster_mount_point>/<ostor_dir>
Trong bài này ta gõ lệnh sau:
Code:
ostor-ctl add-host -r /pstorage/minicloudt9/s3-t9
Bước 7 (thực hiện trên tất cả các node sẽ làm S3 gateway): 

Code:
# ostor-ctl add-s3gw -a <storage_IP>:9000
Trong bài này ta gõ ba lệnh sau trên 3 node

Code:
ostor-ctl add-s3gw -a 172.16.10.24:9000 
ostor-ctl add-s3gw -a 172.16.10.25:9000 
ostor-ctl add-s3gw -a 172.16.10.26:9000
Bước 8 (thực hiện trên tất cả các node sẽ làm S3 gateway): Khởi động agent

Code:
# service ostor-agentd start
# chkconfig ostor-agentd on
Bước 9: Kiểm tra trạng thái của hệ thống

Code:
# ostor-ctl agent-status
Bước 10 (thực hiện trên tất cả các node sẽ làm S3 gateway): Cài đặt và cấu hình Nginx

Cài đặt Nginx
Code:
#  wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
# yum install nginx -y

Cấu hình Nginx: 
Mở file /etc/nginx/conf.d/default.conf và nhập nội dung như bên dưới


Code:
upstream s3 {
    server 172.16.10.24:9000; #S3 gateway 1 internal IP address
    server 172.16.10.25:9000; #S3 gateway 2 internal IP address
     server 172.16.10.26:9000; #S3 gateway 3 internal IP address
        # Optional load balancing parameters (see http://nginx.org/en/docs/http/load_balancing.html)
 }
server {
   listen       80;
  server_name  s3.vinacis.com;      #S3 endpoint. If you have DNS configured, replace the IP address with the corresponding hostname.
  client_max_body_size 5g;
  #charset koi8-r;
  #access_log  /var/log/nginx/log/host.access.log  main;
  location / {
  fastcgi_pass_header Connection-close;
  fastcgi_pass s3;
  fastcgi_no_cache 1;
  include fastcgi_params;
  fastcgi_request_buffering off;
  fastcgi_max_temp_file_size 0;
     }
}
Bước 11: Tạo DNS record s3.vinacis.com trỏ về 3 IP Public của 3 node đang chạy S3 gateway

Bước 12: Khởi động dịch vụ Nginx
Code:
# service nginx start 
# chkconfig nginx on
Bước 13 (thực hiện một trong những node chạy S3) : Tạo tài khoản người dùng S3

Code:
# ostor-s3-admin  create-user -e user@email.com
Ghi lại thông tin Access Key và Secret Access Key dùng để kết nối tạo Bucket

Bước 14: Khởi tạo Bucket mới

Hệ thống Virtuozo 6.0 không có công cụ để khởi tạo Bucket nên ta cần dùng công cụ của hãng thứ 3. Tải về và cài đặt công cụ CloudBerry Explorer for Amazon S3 tại địa chỉ: http://www.cloudberrylab.com/downloa...prod=cbes3free

Mở phần mềm CloudBerry Explorer for Amazon S3 --> File --> Add New Account --> S3 Compatible --> Điền các thông tin như sau

Display name: đặt tên cho kết nối. VD: vinacis
Service point: điền thông tin kết nối đến S3 Gateway. Trong trường hợp này là s3.vinacis.com:80Access key: điền access key lấy được ở bước 13
Secret key: điền Secret access key lấy được ở bước 13

Lưu ý bỏ dấu check ở hai tùy chọn "Use SSL" và "Use native multipath.."

Sau khi kết nối thì tạo Bucket mới
__________________

Không có nhận xét nào:

Đăng nhận xét