etcd、etcd-browser、etcdkeeper(etcd v3 apiをサポート)簡単なインストールと構成
Etcd Etcd Browser Etcdkeeper Simple Installation
1.はじめに
etcdは、値の保存、ノード値のマッピングのためのzkに似たツールです。ノードの編成構造は、最初からUNIXファイルシステムの構造に似ています。
GitHubアドレス:
- etcd: https://github.com/coreos/etcd
- etcd-browser(etcd-webui): https://github.com/henszey/etcd-browser
- etckeeper githubアドレス: https://github.com/evildecay/etcdkeeper
2番目のetcdインストール構成
1.インストール
wget https://github.com/coreos/etcd/releases/download/v3.3.4/etcd-v3.3.4-linux-amd64.tar.gz tar zxvf etcd-v3.3.4-linux-amd64.tar.gz
2.新しい構成ファイル
cd etcd-v3.3.4-linux-amd64 vim etcd.conf # etcd config file name: etcd-1 # Node name data-dir: default.etcd/ # Specify the data storage directory of the node # The address of the external service, the client will connect here to interact with etcd listen-client-urls: http://10.200.0.105:2379,http://127.0.0.1:2379
3.開始
./etcd --config-file etcd.conf
4.使いやすい
./etcdctl set /test/name testvalue # Settings ./etcdctl get /test/name # Get value ./etcdctl --help # View help information
5.クラスター構成
以下は、クラスター関連の構成です。ここでは単一ノードであり、使用されていません
# The external client's listening address of the node client, this value will tell other nodes in the cluster advertise-client-urls: http://10.200.0.105:2379,http://127.0.0.1:2379 # Monitor URL, used to communicate with other nodes listen-peer-urls: http://10.200.0.105:2380 # The peer monitoring address of this node, this value will tell other nodes in the cluster initial-advertise-peer-urls: http://10.200.0.105:2380 # Information of all nodes in the cluster initial-cluster: etcd-1=http://10.200.0.105:2380,etcd-2=http://192.168.108.129:2380 # Create cluster tokens, this value remains unique for each cluster. If you want to re-create the cluster, even if the configuration is the same as before, a new cluster and node uuid will be generated again otherwise it will cause conflicts between multiple clusters and cause unknown errors initial-cluster-token: etcd-cluster-token # When creating a new cluster, this value is new if an existing cluster exists, this value is existing initial-cluster-state: new
3つのetcd-browser(etcd-webui)のインストール
- インストール
yum -y install nodejs git git clone https://github.com/henszey/etcd-browser.git
- 編集を解凍
server.js
ファイル
vim server.js # Edit the following three lines var etcdHost = process.env.ETCD_HOST || '172.17.42.1' # etcd host IP var etcdPort = process.env.ETCD_PORT || 4001 # etcd host port var serverPort = process.env.SERVER_PORT || 8000 # etcd-browser listening port
- 起動
node server.js
4、etcdkeeper3サポートv2サポートetcd v3 api
etcdブラウザ構成は現在etcdv2apiのみをサポートしています
etckeeper githubアドレス: https://github.com/evildecay/etcdkeeper
etcd2とetcd3は互換性がなく、2つのapiパラメーターも異なります。詳細についてはetcdctl-hを確認してください。
api2とapi3を使用してetcd3データを書き込むことができますが、異なるapiバージョンを使用してデータを書き込むには、対応するapiバージョンを使用してデータを読み取る必要があることに注意してください。
API2の使用方法
ETCDCTL_API=2 etcdctl ls /
API3の使用方法
ETCDCTL_API=3 etcdctl get /
例:すべてのキーをクエリします。
$ export ETCDCTL_API=3 $ export ETCD_ENDPOINTS='https://192.168.5.7:2379,https://192.168.5.8:2379,https://192.168.5.86:2379' $ etcdctl --endpoints=${ETCD_ENDPOINTS} get / --prefix --keys-only
etcdv2
etcdv3