QConf简要搭建过程

QConf的组件:
ZooKeeper as the server, restore all configurations, so the limit data size of single configuration item is 1MB, since the size limit of Znode.
qconf_agent is a daemon run on client machine, maintain data in share memory.
share memory, QConf use share memory as the local cache of all configuration items needed by current client.
interface in different programming languages, chose your language for accessing of QConf.

1、准备环境

#yum install -y cmake
#yum install -y gdbm gdbm-devel
#yum install -y automake-devel autoconf m4 perl perl-devel gcc-c++

2、拉取代码,编译安装

# git clone https://github.com/Qihoo360/QConf.git
# cd QConf 
# mkdir build && cd build
# cmake .. -DCMAKE_INSTALL_PREFIX=/opt/qconf
# make
# make install 

3、在QConf 配置文件中配置Zookeeper集群地址

#vim /opt/qconf/conf/idc.conf
# all the zookeeper host configuration.
#[zookeeper]
zookeeper.stg=172.40.0.215:2181,172.40.0.216:2181,172.40.0.217:2181

4、在QConf配置文件中指定本地机房

#vim /opt/qconf/conf/localidc.conf
stg

5、启动QConf

# cd /opt/qconf/bin && bash agent-cmd.sh start
# ps -ef | grep qconf
	root     17703     1  0 13:30 ?        00:00:00 /opt/qconf/bin/qconf_agent
	root     17704 17703  0 13:30 ?        00:00:08 /opt/qconf/bin/qconf_agent

6、尝试用shell取值

qconf usage: qconf command key [idc]
command: can be one of below commands:
                get_conf: get configure value
                get_host: get one service
                get_allhost: get all services available
                get_batch_keys: get all children keys
       key: the path of your configure items
       idc: query from current idc if be omitted
 
# ln -sv /opt/qconf/bin/qconf /usr/bin/
# qconf get_batch_keys configs
	activity-backend
	activity-front
	backend-3.0
	backend-card
	backend-core
	backend-credit
	backend-franchisee
	backend-member
	backend-mobile
	dfb-front
	foo
	front-agent
	front-franchisee
	msgcenter-backend
	msgcenter-front
# qconf get_conf /configs/backend-3.0/dfb3Service
posted @ 2017-03-09 21:23  KeithTt  阅读(1709)  评论(1编辑  收藏  举报