腾讯蓝鲸CMDB项目地址:

https://github.com/Tencent/bk-cmdb

蓝鲸配置平台 (CMDB)
http://172.16.6.10:8088

环境(单机测试):
Centos6 16G 200G
依赖环境:
Java 1.8.0_92
python 2.7
ZooKeeper 3.4.
Redis 3.2.
MongoDB 2.8.

 一、工作目录:

/usr/local/java
/usr/local/python
/opt/cmdb/{zookeeper,redis,monogodb}

 二、安装方式:

yum 依赖:
yum install gcc gcc-c++

 三、java环境变量

、解压缩:
tar -xf jdk-8uxx-linux-x64.gz
mv jdk1..0_xx/ /usr/local/java
xx对应具体的版本号
jdk下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz 、设置环境变量:
echo 'export JAVA_HOME=/usr/local/java' >> /etc/profile
echo 'export JRE_HOME=${JAVA_HOME}/jre' >> /etc/profile
echo 'export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tool.jar' >> /etc/profile
echo 'export PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin:$PATH' >> /etc/profile source /etc/profile
、验证:
java -version

四、python 环境

wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
tar -xf Python-2.7..tgz mv Python-2.7. /usr/local/python
cd /usr/local/python/
./configure --prefix=/usr/local/python/
make &&make install
ln -s /usr/local/python/bin/python2. /usr/bin/python
python -v

 五、redis 安装:

1、端口:
wget http://download.redis.io/releases/redis-3.2.12.tar.gz
2、配置目录:
/opt/cmdb/redis/{data,logs}
tar -xf redis-3.2..tar.gz -C /opt/cmdb/redis
make &&make install
3、配置密码验证 redis.conf
requirepass emcmdb
启动:
nohup ./src/redis-server redis.conf &

六、Mongodb安装:

端口:,
mongodb-linux-x86_64-rhel70-2.8.-rc5.tgz
、配置目录:
/opt/cmdb/mongodb/{data,logs}
tar -xf mongodb-linux-x86_64-rhel70-2.8.-rc5.tgz -C /opt/cmdb/mongodb
、启动配置
nohup ./mongod --rest --dbpath /opt/cmdb/mongodb/data --logpath /opt/cmdb/mongodb/logs/mongod.log &

 配置 mongo 验证

进入mongo 配置密码 (切换 mongo主目录)
./bin/monogo
> use admin
switched to db admin
> db.createUser({user:'root',pwd:'1qaz@WSX',roles:['root']})
Successfully added user: { "user" : "root", "roles" : [ "root" ] }
> db.auth('root','1qaz@WSX')
1
# 创建 cmdb 库 设置密码
> use cmdb
switched to db cmdb
> db.createUser({user:"cc",pwd:"cc",roles:[{role:"readWrite",db:"cmdb"}]})
Successfully added user: {
"user" : "cc",
"roles" : [
{
"role" : "readWrite",
"db" : "cmdb"
}
]
}
> exit

 七、Zookeeper 安装;

端口:
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.12/zookeeper-3.4.12.tar.gz
tar -xf zookeeper-3.4..tar.gz -C /opt/cmdb/zookeeper
1、配置文件
cp -a zoo_sample.cfg zoo.cfg
2、启动:
./bin/zkServer.sh start

 八、腾讯蓝鲸 CMDB 包

下载包:

源码地址:
https://github.com/Tencent/bk-cmdb/releases
https://codeload.github.com/Tencent/bk-cmdb/tar.gz/release-v3.5.20
源码编译示例:
https://www.cnblogs.com/sharesdk/p/12031023.html
版本 3.5.
版本 编译好的包下载:
链接:https://pan.baidu.com/s/1qJuEZelSRnHXCgUCgDMJdQ
提取码:r8o5 tar -xf cmdb.tar.gz -C /opt/cmdb/cmdb

1、生成配置脚本,注意需要换成自己IP地址,配置redis密码

、生成配置文件(配置文件目录 cmdb_adminserver/configures/
python init.py --discovery 127.0.0.1: --database cmdb --redis_ip 172.16.6.10 --redis_port --redis_pass 1qaz@WSX --mongo_ip 127.0.0.1 --mongo_port --mongo_user cc --mongo_pass cc --blueking_cmdb_url http://172.16.6.10:8088 --listen_port 8088
、启动
/opt/cmdb/cmdb/start.sh

2、配置文件示例:

python init.py  \
--discovery 172.16.6.10: \
--database cmdb \
--redis_ip 172.16.6.10 \
--redis_port \
--redis_pass emcmdb \
--mongo_ip 172.16.6.10 \
--mongo_port \
--mongo_user cc \
--mongo_pass cc \
--blueking_cmdb_url http://172.16.6.10:8088/ \
--listen_port \

3、 配置文件生成目录

腾讯蓝鲸cmdb部署-LMLPHP

4、启动(切换cmdb部署主目录)

./start.sh

5、初始化数据库

初始化数据库,切换cmdb主目录。
# cd /opt/cmdb/cmdb
# sh init_db.sh
{
"result": true,
"bk_error_code": ,
"bk_error_msg": "success",
"data": "migrate success"
}
#

九、测试访问:(iptables 放开以上涉及端口)

http://172.16.6.10:8088

腾讯蓝鲸cmdb部署-LMLPHP

腾讯蓝鲸cmdb部署-LMLPHP

腾讯蓝鲸cmdb部署-LMLPHP

腾讯蓝鲸cmdb部署-LMLPHP

腾讯蓝鲸cmdb部署-LMLPHP

05-11 20:14