適用場景
多組共用etcd集群,創(chuàng)建一個新用戶拍嵌、新目錄遭赂,讓這個新用戶只有新目錄的使用權(quán)限。
命令和順序
創(chuàng)建目錄横辆,注意此處是v2
curl -u root:pwd http://host:2379/v2/keys/dir -XPUT -d dir=true
查看用戶列表
./etcdctl -u root:pwd --endpoints=http://host:2379 user list
添加用戶
./etcdctl -u root:pwd --endpoints=http://host:2379 user list
查看角色列表
./etcdctl -u root:pwd --endpoints=http://host:2379 role list
添加角色
./etcdctl -u root:pwd --endpoints=http://host:2379 role add systech_nsq
賦予角色指定目錄權(quán)限
./etcdctl -u root:pwd --endpoints=http://host:2379 role grant systech_nsq -path '/b2c_systech_nsq/*' -readwrite
查看角色權(quán)限
./etcdctl -u root:pwd --endpoints=http://host:2379 role get systech_nsq
賦予用戶角色
./etcdctl -u root:pwd --endpoints=http://host:2379 user grant systech_nsq -roles systech_nsq