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.

1005945-20170309212102203-300567979.png

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

转载于:https://www.cnblogs.com/keithtt/p/6527957.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值