How to prepare S3 Cloud server on Ubuntu 16.04 and OEL7.X

What is Docker?

docker 基本教學 – 從無到有 Docker-Beginners-Guide

https://github.com/twtrubiks/docker-tutorial

Install Docker environment on Ubuntu 16.04

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo apt-get install c

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

sudo add-apt-repository “deb [arch=amd64]   https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”

sudo apt-get update

apt-cache policy docker-ce

sudo apt-get install -y docker-ce

sudo systemctl status docker

sudo usermod -aG docker phillips

sudo docker search scality

sudo docker pull scality/s3server

sudo docker run -d –name s3server -p 8000:8000  scality/s3server

sudo docker stop s3server

sudo docker stats

sudo docker start s3server

sudo docker ps # help list container id

sudo docker exec -i -t $container_id bash # login to running image

apt-get update

apt-get install vim

vim package.json

“multiple_backend_test”: “CI=true S3BACKEND=file S3DATA=multiple mocha -t 20000 –recursive tests/multipleBackend”,

Reference https://github.com/scality/cloudserver/blob/master/docs/DOCKER.rst#using-docker-volumes-in-production

Install Docker environment on CentOS7/OEL7

#wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/container-selinux-2.68-1.el7.noarch.rpm

#yum install selinux-policy-base selinux-policy-targeted

#rpm -ihv container-selinux-2.68-1.el7.noarch.rpm

sudo yum-config-manager     –add-repo https://download.docker.com/linux/centos/docker-ce.repo

#yum install docker-ce

#docker images

#docker run -d –name s3server -p 8000:8000  scality/s3server

Login to s3Server docker system

sudo docker ps # finger out which one is s3server

sudo docker exec -i -t f9168e7bb704 bash

Show Log with s3Server running docker image

docker logs -f –tail 100 s3server

How to check Docker image location

Run df command in docker OS

root@a38cc05c505f:/# df | grep docker

/dev/mapper/docker-249:0-30860-7ef93373c452af140193f9e036dcca447512b21648d36454140bcb38b00c4349  26201600 374216 25827384 2% /

Check on Linux

[root@FS3147 devicemapper]# df -kh| grep \ 7ef93373c452af140193f9e036dcca447512b21648d36454140bcb38b00c4349

/var/lib/docker/devicemapper/mnt/7ef93373c452af140193f9e036dcca447512b21648d36454140bcb38b00c4349

[root@FS3147 devicemapper]# ls  /var/lib/docker/devicemapper/mnt/7ef93373c452af140193f9e036dcca447512b21648d36454140bcb38b00c4349/rootfs/

bin  boot dev  etc home lib  lib64 media mnt  opt proc root run  sbin srv sys tmp usr  var

Reference https://docs.docker.com/storage/storagedriver/#images-and-layers

How to use another storage for S3server storage input data

https://docs.docker.com/storage/bind-mounts/#start-a-container-with-a-bind-mount

We can prepare another large storage for docker image storage data

$sevice docker stop

$rsync -av –progress /var/lib/docker/volume/ /mnt/largesapce/

$mount –bind /mnt/largespace /var/lib/docker/volume

add new line to fstab

/mnt/largespace /var/lib/docker/volume none bind

How to install S3server for OEL7 # not for QA test

Install nodejs environment on OEL7.X

https://yum.oracle.com/oracle-linux-nodejs.html

Enabling Required Repositories

The installation instructions below require different Oracle Linux yum server repositories to be enabled, depending on what you are installing. For example, to enable the ol7_developer_nodejs6 repository:

$ sudo yum install -y yum-utils

$ sudo yum-config-manager –enable ol7_developer_nodejs6

If your yum configuration doesn’t have the required repository, grab the latest Oracle Linux yum configuration by running the these commands as the root user:

On Oracle Linux 7

# cd /etc/yum.repos.d

# mv public-yum-ol7.repo public-yum-ol7.repo.bak

# wget http://yum.oracle.com/public-yum-ol7.repo

On Oracle Linux 6

# cd /etc/yum.repos.d

# mv public-yum-ol6.repo public-yum-ol6.repo.bak

# wget http://yum.oracle.com/public-yum-ol6.repo

Installing Node.js

To install Node.js from this repository, ensure you have the latest Oracle Linux Yum server repo file and enable the appropriate repository.

To install Node.js:

$ sudo yum install nodejs

Define S3server storage location

Refer link https://github.com/scality/cloudserver#run-it-with-a-file-backend

By default the metadata files will be saved in the localMetadata directory and the data files will be saved in the localData directory within the ./S3 directory on your machine. These directories have been pre-created within the repository. If you would like to save the data or metadata in different locations of your choice, you must specify them with absolute paths. So, when starting the server:

mkdir -m 700 $(pwd)/myFavoriteDataPath
mkdir -m 700 $(pwd)/myFavoriteMetadataPath
export S3DATAPATH=”$(pwd)/myFavoriteDataPath”
export S3METADATAPATH=”$(pwd)/myFavoriteMetadataPath”

Run S3server with an in-memory backend

npm run mem_backend

PS: his is ideal for testing – no data will remain after container is shutdown.

[root@FS3147 S3]# npm run mem_backend

> @zenko/cloudserver@8.1.0-beta mem_backend /root/git/Scality/S3

> S3BACKEND=mem node index.js

{“name”:”S3″,”time”:1540267219174,”level”:”warn”,”message”:”scality kms unavailable. Using file kms backend unless mem specified.”,”hostname”:”FS3147″,”pid”:10978}

{“name”:”S3″,”time”:1540267219204,”bootstrap”:[“localhost”],”https”:false,”level”:”info”,”message”:”bucketclient configuration”,”hostname”:”FS3147″,”pid”:10978}

{“name”:”S3″,”time”:1540267219308,”https”:false,”level”:”info”,”message”:”Http server configuration”,”hostname”:”FS3147″,”pid”:10978}

{“name”:”S3″,”time”:1540267219311,”address”:”::”,”port”:8000,”pid”:10978,”level”:”info”,”message”:”server started”,”hostname”:”FS3147″}

{“name”:”S3″,”time”:1540267224311,”req_id”:”542591d8bc4086133efa”,”level”:”info”,”message”:”remote management disabled”,”hostname”:”FS3147″,”pid”:10978}

Reference https://github.com/scality/cloudserver/blob/master/docs/DOCKER.rst

   S3BACKEND=file

When storing file data, for it to be persistent you must mount docker volumes for both data and metadata. See this section

   S3BACKEND=mem

This is ideal for testing – no data will remain after container is shutdown.

We can edit the S3/package.json file to define S3BACKEND parameter

Support IPv6

Scaly S3server support IPv6 coding

https://github.com/scality/cloudserver/pull/482

Docker support IPv6

https://docs.docker.com/v17.09/engine/userguide/networking/default_network/ipv6/#switched-network-environment

We have found the workaround method for setup scality s3server for IPv6 dual-stack

edit the S3server file

vim S3/config.json #add new entry for S3 server IPv6 name mapping

{

“port”: 8000,

“listenOn”: [],

“replicationGroupId”: “RG001”,

“restEndpoints”: {

    “localhost”: “us-east-1”,

    “127.0.0.1”: “us-east-1”,

    “cloudserver-front”: “us-east-1”,

    “s3.docker.test”: “us-east-1”,

    “127.0.0.2”: “us-east-1”,

           “aws.s3server.local”: “us-east-1”,

    “2001:db8:100::199”: “us-east-1”,

    “s3.amazonaws.com”: “us-east-1”,

    “zenko-cloudserver-replicator”: “us-east-1”,

    “lb”: “us-east-1”

},

….

edit /etc/hosts at S3server and OBD/FBD side # add IPv6 name resolve entry

2001:db8:100::199 aws.s3server.local s3.amazonaws.com

Run iscon object-storage-add via IPv6

iscon object-storage-add -s 127.0.0.1 -Ot AWS_S3 -Os verySecretKey1 -Oi accessKey1 -Ou http://aws.s3server.local:8000 -Ob vtl-bucket

Command: object-storage-add executed successfully.

For double check with aws-cli

https://docs.aws.amazon.com/en_us/AmazonS3/latest/dev/dual-stack-endpoints.html#dual-stack-endpoints-description

aws –endpoint-url “http://aws.s3server.local:8000/” s3api create-bucket –bucket guumaster6

{

“Location”: “/guumaster6”

}

The issue is iscon cannot send out the IPv6 address format

$iscon object-storage-add -s 127.0.0.1 -Ot AWS_S3 -Os verySecretKey1 -Oi accessKey1 -Ou http://2001:db8:100::199:8000 -Ob vtl-bucket

AWS cli

https://docs.aws.amazon.com/en_us/cli/latest/userguide/installing.html

cat ~/.aws/config

[default]

access_key = accessKey1

secret_key = verySecretKey1

signature_v2 = True

user_https = False

cat ~/.aws/credentials

[default]

aws_access_key_id = accessKey1

aws_secret_access_key = verySecretKey1

Run aws cli to create bucket

#aws –endpoint-url http://192.168.1.29:8000/ s3api create-bucket –bucket guumaster

Check the S3server with tool called duplicity

Test Tool

Reference https://www.zenko.io/blog/backup-files-s3-server-duplicity/

http://duplicity.nongnu.org/index.html

https://github.com/librsync/librsync

Install librsync

git clone https://github.com/librsync/librsync.git

cd librsync/

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release .

sudo make install

sudo vi /etc/ld.so.conf.d/x86_64-linux-gnu.conf

Add “/usr/local/lib/x86_64-linux-gnu”

sudo ldconfig

Install duplicity

cd duplicity-0.7.18.2

sudo python setup.py install

sudo pip install boto

sudo vi /etc/boto.cfg

[Credentials]

aws_access_key_id = accessKey1

aws_secret_access_key = verySecretKey1

[Boto]

# If using SSL, set to True

is_secure = False

# If using SSL, unmute and provide absolute path to local CA certificate

# ca_certificates_file = /absolute/path/to/ca.crt

Run Test

duplicity full  tmp/ “s3://172.22.17.29:8000/testbucket/”

Restore file Test

duplicity –file-to-restore  NC.jar “s3://172.22.2.38:8000/testbucket/”  tmp/NC.jar

Restore all Test

duplicity restore  “s3://172.22.2.38:8000/testbucket/”  tmp/

VTL/FBC iscon object-storage-add

Setup with VTL/FBD

iscon object-storage-add -s 127.0.0.1 -Ot AWS_S3 -Os verySecretKey1 -Oi accessKey1 -Ou http://172.22.17.29:8000 -Ob vtl-bucket

Tool for easy management Docker contanter(s)

Management Docker contanter

https://portainer.readthedocs.io/en/latest/deployment.html

Read more

世界越快心越慢

在晚飯後的休息時間,我特別享受在客廳瀏灠youtube上各樣各式創作者的影音作品。很大不同於傳統媒體,節目多是針對大多數族群喜好挑選的,在youtube上我會依心情看無腦的動畫、一些旅拍記錄、新聞時事談論。 尤其在看了大量的Youtube的分享後,我真的感受到會限制我的是我的無知,特別是那些我想都沒想過的實際應用,在學習後大大幫助到我的生活和工作層面。 休息在家時,我喜歡想一些沒做過的菜,動手去設計生活和工作上的解決方案,自己是真的很難閒著沒事做。 如創作文章,陪養新的習慣都能感覺到成長的喜悅,是不同於吃喝玩樂的快樂的。 創作不去限制固定的形式,文字是創作、影像聲音也是創作,記錄生活也是創作,我想留下的就是創造—》實現—》回憶,這樣子的循環過程,在留下的足跡面看到自己一路上的成長、失敗、絕望、重新再來。 雖然大部份的時候去做這些創作也不明白有什麼特別的意義,但不去做也不會留下什麼,所以呀不如反事都去試試看,也許能有不一樣的水花也許有意想不到的結果,投資自己永遠不會是失敗的決定,不是嗎?先問問自己再開始計畫下一步,未來沒人說得準。 像最近看youtube仍大一群人在為DOS開

By Phillips Hsieh

知識管理的三個步驟:一小時學會把知識運用到生活上

摘錄瓦基「閱讀前哨站」文章作為自己學習知識管理的內容 Part1「篩選資訊」 如何從海量資訊中篩選出啟發性、實用性和相關性的精華,讓你在學習過程中不再迷失方向。 1. 實用性 2. 啟發性 Part2「提高理解」 如何通過譬喻法和應用法,將抽象的知識與日常生活和工作緊密結合,建立更深刻的理解。 1. 應用法 2. 譬喻法 Part3「運用知識」 如何連結既有知識,跟自己感興趣的領域和專案產生關聯,讓你在運用知識的路途上游刃有餘。 1. 跟日常工作專案、人際活動產生連結 # 為什麼要寫日記? * 寫日記是為了忘記,忘卻瑣碎事情,保持專注力 * 寫日記就像在翻譯這個世界,訓練自己的解讀能力 * 不只是透過日記來記錄生活,而是透過日記來發展生活 #如何寫日記? * 不要寫流水帳式的日記,而是寫覆盤式的日記 當我們試著記錄活動和感受之間的關聯,有助於辦認出真正快樂的事 日記的記錄方式要以過程為主,而非結果 * 感恩日記的科學建議,每日感恩的案例

By Phillips Hsieh
2024年 3月30日 14屆美利達環彰化百K

2024年 3月30日 14屆美利達環彰化百K

這是場半小時就被秒報名額滿的經典賽事, 能順利出賽實屬隊友的功勞, 這次的準備工作想試試新買的外胎, 因為是無內胎用的外胎, 特別緊超級難安裝的, 問了其他朋友才知道, 要沾上肥皂水才容易滑入車框。 一早四點起床準備, 五點集合備好咖啡在車上飲用, 約了六點在彰化田尾鄉南鎮國小, 整好裝四人一起出發前往會場。 被排在最後一批出發, 這次的路線會繞行的員林148上139縣道, 其實在早上五點多天就開始有點飄雨, 大伙就開始擔心不會要雨戰吧! 果不其然才出發準備上148爬坡雨勢越來越大, 戴著防風眼鏡的我在身體的熱氣加上雨水冷凝效果下, 鏡面上滿是霧氣肉眼可視距離才剩不到五公尺, 只能緊依前前方的車友幫忙開路, 之後洪大跟上來我立馬請求他幫忙開路, 上了139停下車把防風眼鏡收起來, 反正下雨天又陰天完全用不到太陽眼鏡了。 雨是邊下邊打雷, 大伙都在這條139上一台一台單車好像避電針, 一時有點害怕不然想平時沒做什麼壞事, 真打到自己就是天意了。 下了139雨勢開始變小, 大伙的速度開始有所提昇, 開高鐵列車的時機己成熟, 物色好列車就跟好跟滿。 最後找了一隊似乎整團有固定在練

By Phillips Hsieh
2023 12月9號 美利達單車嘉年華

2023 12月9號 美利達單車嘉年華

第二次參加美利達環南投賽事, 還記得去年第一次參加這美利達環南投, 還特地提前一天跟車友在魚池住了一晚。 這回用上了剛在7月份剛安裝的車頂架, 安裝了二種不同的攜車架, 都樂這邊可以不用拆車輪直上車頂, YAKIMA這邊選了經濟的款式, 折掉前輪利用前叉固定在攜車架上。 約了唯一一位一起參加的朋友, 二人一早四點約見面, 幫朋友帶上了拿鐵咖啡, 開上日月潭在水社碼頭停好車, 騎往向山遊客中心, 路過美麗的日月潭簡直不要太美了拍一張。 抵達會場己是人山人海了, 跟著大伙排隊順便也看網紅也欣賞名車。 出發就先沿著日月潭順時針騎, 騎到玄裝寺很急停下來上一下廁所, 比賽時都會尿都特別的滿, 一方面是比較緊張,一方面是特別興奮。 這時己經跟車友失散了, 只能獨推沿路看有沒有車友可以一起組隊的, 很可惜在山區大家的實力不一只求平安順騎了, 原則就是有補給就停有食物就吃。 下到水里人群再次聚集起來, 光等紅綠燈就是一條車龍。 騎行了一大圈水里再回到131縣道, 這時背後傳來熟悉的聲音叫菲哥, 終於跟車友重新集合接下來就一路邊聊邊騎。 最後來幾張專業攝影師拍攝的照片 回到終點台上

By Phillips Hsieh