- 下载Qconf
[root@ZKDASH src]# wget https://github.com/Qihoo360/QConf/releases/download/1.2.1/QConf-1.2.1-1.el6.x86_64.rpm
- 安装QConf
[root@ZKDASH src]# rpm -ivh QConf-1.2.1-1.el6.x86_64.rpm
#设置环境变量
[root@ZKDASH src]# vim /etc/profile
在profile中添加如下内容:
### qconf ###
QCONF_HOME=/usr/local/qconf
PATH=$QCONF_HOME/bin:$PATH
export QCONF_HOME
export PATH
#让修改生效:
[root@ZKDASH src]# source /etc/profile
1. 启动qconf-agent
[root@ZKDASH src]# cd /usr/local/qconf
[root@ZKDASH src]#cd bin
[root@ZKDASH src]# chmod +x agent-cmd.sh
[root@ZKDASH src]# agent-cmd.sh start
[root@ZKDASH ~]# cat /usr/local/qconf/conf/idc.conf
###################################################################
# QCONF config #
###################################################################
# all the zookeeper host configuration.
#[zookeeper]
zookeeper.test=127.0.0.1:2181
[root@ZKDASH src]# service zookeeper start
- 测试Qconf
[root@ZKDASH src]# zkCli.sh -server 192.168.40.162:2181
create /demo demo
create /demo/confs confs
create /demo/confs/conf1 111111111111111111111
create /demo/confs/conf2 222222222222222222222
create /demo/confs/conf3 333333333333333333333
3. 获取值
1) 使用 shell 命令获取:
qconf get_conf /demo/confs/conf1
qconf get_batch_keys /demo/confs