自动化运维-自动化扩容介绍加etcd部署
2015-11-18 16:09
531 查看
saltstack ----- haproxy ------jinja
cd /usr/local/src/
rz -y
tar xf etcd-v2.2.1-linux-amd64.tar.gz
cd etcd-v2.2.1-linux-amd64
cp etcd etcdctl /usr/local/bin/
etcd --version
mkdir -p /data/etcd
nohup etcd --name auto_scale --data-dir /data/etcd/ --listen-peer-urls 'http://10.0.0.7:2380,http://10.0.0.7:7001' --listen-client-urls 'http://10.0.0.7:2379,http://10.0.0.7:4001' --
advertise-client-urls 'http://10.0.0.7:2379,http://10.0.0.7:4001' &
[root@linux-node1 etcd-v2.2.1-linux-amd64]# netstat -ntlp | grep etcd
tcp 0 0 10.0.0.7:4001 0.0.0.0:* LISTEN 8680/etcd
tcp 0 0 10.0.0.7:2379 0.0.0.0:* LISTEN 8680/etcd ========>交互端口
tcp 0 0 10.0.0.7:2380 0.0.0.0:* LISTEN 8680/etcd
tcp 0 0 10.0.0.7:7001 0.0.0.0:* LISTEN 8680/etcd
设置一个key: set
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message -XPUT -d value="Hello world" | python -m json.tool
{
"action": "set",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
-d post的数据
获取一个key: get
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message | python -m json.tool {
"action": "get",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
删除一个key: delete
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message -XDELETE | python -m json.tool
{
"action": "delete",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 6
},
"prevNode": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
设置一个时间key:
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/ttl_use -XPUT -d value="Hello world 1" -d ttl=30 | python -m json.tool
key名称为:ttl_use
key的value值为:Hello world 1
ttl时间为:30s
{
"action": "set",
"node": {
"createdIndex": 13,
"expiration": "2015-11-18T02:25:08.727313182Z",
"key": "/ttl_use",
"modifiedIndex": 13,
"ttl": 30,
"value": "Hello world 1"
}
}
获取key值:
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/ttl_use| python -m json.tool
{
"action": "get",
"node": {
"createdIndex": 13,
"expiration": "2015-11-18T02:25:08.727313182Z",
"key": "/ttl_use",
"modifiedIndex": 13,
"ttl": 4,
"value": "Hello world 1"
}
}
老男孩网址:http://www.etiantian.org
qq:406564728
欢迎交流
cd /usr/local/src/
rz -y
tar xf etcd-v2.2.1-linux-amd64.tar.gz
cd etcd-v2.2.1-linux-amd64
cp etcd etcdctl /usr/local/bin/
etcd --version
mkdir -p /data/etcd
nohup etcd --name auto_scale --data-dir /data/etcd/ --listen-peer-urls 'http://10.0.0.7:2380,http://10.0.0.7:7001' --listen-client-urls 'http://10.0.0.7:2379,http://10.0.0.7:4001' --
advertise-client-urls 'http://10.0.0.7:2379,http://10.0.0.7:4001' &
[root@linux-node1 etcd-v2.2.1-linux-amd64]# netstat -ntlp | grep etcd
tcp 0 0 10.0.0.7:4001 0.0.0.0:* LISTEN 8680/etcd
tcp 0 0 10.0.0.7:2379 0.0.0.0:* LISTEN 8680/etcd ========>交互端口
tcp 0 0 10.0.0.7:2380 0.0.0.0:* LISTEN 8680/etcd
tcp 0 0 10.0.0.7:7001 0.0.0.0:* LISTEN 8680/etcd
设置一个key: set
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message -XPUT -d value="Hello world" | python -m json.tool
{
"action": "set",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
-d post的数据
获取一个key: get
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message | python -m json.tool {
"action": "get",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
删除一个key: delete
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/message -XDELETE | python -m json.tool
{
"action": "delete",
"node": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 6
},
"prevNode": {
"createdIndex": 5,
"key": "/message",
"modifiedIndex": 5,
"value": "Hello world"
}
}
设置一个时间key:
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/ttl_use -XPUT -d value="Hello world 1" -d ttl=30 | python -m json.tool
key名称为:ttl_use
key的value值为:Hello world 1
ttl时间为:30s
{
"action": "set",
"node": {
"createdIndex": 13,
"expiration": "2015-11-18T02:25:08.727313182Z",
"key": "/ttl_use",
"modifiedIndex": 13,
"ttl": 30,
"value": "Hello world 1"
}
}
获取key值:
[root@linux-node1 /]# curl -s http://10.0.0.7:2379/v2/keys/ttl_use| python -m json.tool
{
"action": "get",
"node": {
"createdIndex": 13,
"expiration": "2015-11-18T02:25:08.727313182Z",
"key": "/ttl_use",
"modifiedIndex": 13,
"ttl": 4,
"value": "Hello world 1"
}
}
老男孩网址:http://www.etiantian.org
qq:406564728
欢迎交流
相关文章推荐
- IE:“自动完成”功能
- C#实现开机自动启动设置代码分享
- jQuery实现首页顶部可伸缩广告特效代码
- 一个不太让人讨厌的自动弹出窗口
- C#中winform实现自动触发鼠标、键盘事件的方法
- jQuery 实现自动填充邮箱功能(带下拉提示)
- JSP + ajax实现输入框自动补全功能 实例代码
- 自动跳转中英文页面
- js实现每日自动换一张图片的方法
- C#实现延时并自动关闭MessageBox的方法
- php-fpm开机自动启动Shell脚本
- PHP实现自动登入google play下载app report的方法
- ThinkPHP自动完成中使用函数与回调方法实例
- Centos6.5全自动安装 vsftpd+dhcp+nfs+tftp
- ThinkPHP表单自动验证实例
- 复制网页内容,粘贴之后自动加上网址的实现方法(脚本之家特别整理)
- JS输入用户名自动显示邮箱后缀列表的方法
- jQuery自动添加表单项的方法
- python实现自动重启本程序的方法
- Linux网络编程:原始套接字的魔力【上】