[Rclone] Hướng dẫn đồng bộ dữ liệu linux lên S3 Nhân Hòa Cloud Storage

Tác giả: 26/09/2025

Khi đăng ký gói Nhân Hòa Cloud Storage thì quý khách sẽ nhận được email thông tin như sau:

URLhttps://console.smartstorage.cloud
Email:*******@********
Password: ****************

Thông tin này dùng để login vào tạo bucket, quản lý file được đồng bộ lên cloud.

ACCESS-KEY:< ACCESS KEY>
SECRET-KEY: <SECRETKEY>

Thông tin ACCESS-KEY, SECRET-KEY dùng để kết nối từ máy linux lên bucket được tạo trên trang quản lý storage.

Bước 1: Tạo bucket trên trang quản lý storage.

Đăng nhập vào link https://console.smartstorage.cloud sau đó bấm Create Bucket

Tại Bucket Name: Đặt tên cần tạo, không khoảng cách, không viết hoa, không có dấu.

Select Region: Chọn region cần dùng và ghi nhớ thông tin region để tí kết nối trên Windows.

Bấm Create.

 

Bước 2: Cài đặt Rclone

Chạy lệnh sau để cài đặt Rclone:

sudo -v ; curl https://rclone.org/install.sh | sudo bash

Với các OS thuộc RHEL-based cần cài thêm gói unzip nếu thiếu.

sudo yum install unzip -y

Bước 3: Kết nối remote Clone vào bucket vừa tạo.

Gõ lệnh để tạo kết nối remote giữa Rclone và S3 storage:

rclone config

Sau đó config các bước như sau:

root@server:~# rclone config
2025/09/26 14:18:32 NOTICE: Config file “/root/.config/rclone/rclone.conf” not found – using defaults
No remotes found, make a new one?
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n

Enter name for new remote.
name> tenremote  đặt tên remote clone

Option Storage.
Type of storage to configure.
Choose a number from below, or type in your own value.
…………
4 / Amazon S3 Compliant Storage Providers including AWS, Alibaba, ArvanCloud, Ceph, ChinaMobile, Cloudflare, DigitalOcean, Dreamhost, Exaba, FlashBlade, GCS, HuaweiOBS, IBMCOS, IDrive, IONOS, LyveCloud, Leviia, Liara, Linode, Magalu, Mega, Minio, Netease, Outscale, OVHcloud, Petabox, RackCorp, Rclone, Scaleway, SeaweedFS, Selectel, StackPath, Storj, Synology, TencentCOS, Wasabi, Qiniu, Zata and others
\ (s3)
………
Storage>

…….

36 / Wasabi Object Storage
\ (Wasabi)

……….

provider> 36    số thứ tự có thể thay đổi nên chỉ cần nhập đúng số đang có Wasabi Object Storage là được. 

Option env_auth.
Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars).
Only applies if access_key_id and secret_access_key is blank.
Choose a number from below, or type in your own boolean value (true or false).
Press Enter for the default (false).
1 / Enter AWS credentials in the next step.
\ (false)
2 / Get AWS credentials from the environment (env vars or IAM).
\ (true)
env_auth> 1

Option access_key_id.
AWS Access Key ID.
Leave blank for anonymous access or runtime credentials.
Enter a value. Press Enter to leave empty.
access_key_id> < ACCESS KEY>      điền access key trong mail thông tin gửi

………
secret_access_key>  <SECRETKEY>    điền secret key trong mail thông tin gửi

Option region.
Region to connect to.
Leave blank if you are using an S3 clone and you don’t have a region.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
/ Use this if unsure.
1 | Will use v4 signatures and an empty region.
\ ()
/ Use this only if v4 signatures don’t work.
2 | E.g. pre Jewel/v10 CEPH.
\ (other-v2-signature)
region> 1

Option endpoint.
Endpoint for S3 API.
Required when using an S3 clone.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
1 / Wasabi US East 1 (N. Virginia)
\ (s3.wasabisys.com)
………….
endpoint> 1

Option location_constraint.
Location constraint – must be set to match the Region.
Leave blank if not sure. Used when creating buckets only.
Enter a value. Press Enter to leave empty.
location_constraint>     enter

Option acl.
Canned ACL used when creating buckets and storing or copying objects.
This ACL is used for creating objects and if bucket_acl isn’t set, for creating buckets too.
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Note that this ACL is applied when server-side copying objects as S3
doesn’t copy the ACL from the source but rather writes a fresh one.
If the acl is an empty string then no X-Amz-Acl: header is added and
the default (private) will be used.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
/ Owner gets FULL_CONTROL.
1 | No one else has access rights (default).
\ (private)
…………….
acl> 1

Edit advanced config?
y) Yes
n) No (default)
y/n> y

Option bucket_acl.
Canned ACL used when creating buckets.
For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl
Note that this ACL is applied when only when creating buckets. If it
isn’t set then “acl” is used instead.
If the “acl” and “bucket_acl” are empty strings then no X-Amz-Acl:
header is added and the default (private) will be used.
Choose a number from below, or type in your own value.
Press Enter to leave empty.
/ Owner gets FULL_CONTROL.
1 | No one else has access rights (default).
\ (private)
…………..
bucket_acl> 1

Option upload_cutoff.
Cutoff for switching to chunked upload.
Any files larger than this will be uploaded in chunks of chunk_size.
The minimum is 0 and the maximum is 5 GiB.
Enter a size with suffix K,M,G,T. Press Enter for the default (200Mi).
upload_cutoff>    enter

chunk_size>    enter

max_upload_parts>    enter

copy_cutoff>    enter

disable_checksum>    enter

shared_credentials_file>    enter

profile>    enter

session_token>    enter

upload_concurrency>    enter

force_path_style>    enter

v2_auth>    enter

use_dual_stack>    enter

use_arn_region>    enter

list_chunk>    enter

list_version>    enter

list_url_encode>    enter

no_check_bucket>    enter

no_head>    enter

no_head_object>    enter

encoding>    enter

disable_http2>    enter

download_url>    enter

directory_markers>    enter

use_multipart_etag>    enter

use_unsigned_payload>    enter

use_presigned_request>    enter

versions>    enter

version_at>    enter

version_deleted>    enter

decompress>    enter

might_gzip>    enter

use_accept_encoding_gzip>    enter

no_system_metadata>    enter

use_already_exists>    enter

use_multipart_uploads>    enter

use_x_id>    enter

sign_accept_encoding>    enter

sdk_log_mode>    enter

description>    enter

Edit advanced config?
y) Yes
n) No (default)
y/n> n

Configuration complete.
Options:
– type: s3
– provider: Wasabi
– access_key_id: < ACCESS KEY>
– secret_access_key: <SECRETKEY>
– endpoint: s3.wasabisys.com
– acl: private
– bucket_acl: private
Keep this “tenremote” remote?
y) Yes this is OK (default)
e) Edit this remote
d) Delete this remote
y/e/d> y

Current remotes:

Name Type
==== ====
tenremote s3

e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>q

Bước 4: Kiểm tra kết nối với bucket

Kiểm tra xem máy chủ linux đã kết nối được với bucket chưa: rclone lsd <tên remote vừa đặt ở trên>:

Nếu thấy được bucket qua lệnh trên có thể bắt đầu chuyển dữ liệu lên: rclone copy /root/data <tên remote>:<tên bucket> -v –log-file=/root/data/rclone.log

Trong đó:

/root/data: là thư mục cần đồng bộ dữ liệu lên storage

<tên remote>là tên remote đặt lúc config.

<tên bucket>là tên bucket đặt trên trang quản lý storage.

rclone.log: ghi lại log quá trình update dữ liệu.

Sau khi chạy đồng bộ xong dữ liệu có thể kiểm tra trên trang storage dữ liệu.

Hoặc có thể kiểm tra trực tiếp bằng lệnh trên máy chủ linux.

 

Bước 5: Đặt lịch tự đồng bộ dữ liệu daily.

Chạy lệnh crontab -e

Thêm vào các dòng sau:

SHELL=/bin/bash

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

15 15 * * * /bin/bash -c “rclone copy <thư mục dữ liệu đồng bộ> <tên remote>:<tên bucket> -v –log-file=<thư mục chứa rclone.log>”

wq: để lưu lại.

Thời gian có thể thay đổi cho phù hợp với nhu cầu của quý khách. Có thể dùng tool tại trang sau để tạo thời gian phù hợp: https://crontab.guru/

Sau đó có thể theo dõi để xem cron có hoạt động và dữ liệu đã được đồng bộ chưa.

Chúc quý khách thành công !