腾讯蓝鲸CMDB 部署文档

1、部署ZooKeeper

推荐版本下载: ZooKeeper 3.4.12

wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.14/zookeeper-3.4.14.tar.gz

mv /opt/software/zookeeper-3.4.12/conf/zoo_sample.cfg   /opt/software/zookeeper-3.4.12/conf/zoo.cfg

vim /opt/software/zookeeper-3.4.12/conf/zoo.cfg

dataDir=/opt/software/zookeeper-3.4.12/data

dataLogDir=/opt/software/zookeeper-3.4.12/log

mkdir -p /opt/software/zookeeper-3.4.12/data

./zkServer.sh start

2. 部署Redis

推荐版本下载: Redis 3.2.11

wget http://download.redis.io/releases/redis-3.2.11.tar.gz

tar xzf redis-3.2.11.tar.gz

cd redis-3.2.11

make

vim redis.conf

daemonize yes

Redis需要打开auth认证的功能,并为其配置密码

src/redis-server redis.conf

3. 部署MongoDB

推荐版本下载:MongoDB 3.6.0

浏览器下载http://downloads.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.6.0-rc5.tgz?_ga=2.109966917.1194957577.1522583108-162706957.1522583108

mkdir -p /data/db

./mongod

./mongo

> use cmdb

> db.createUser({user: “cc”,pwd: “cc”,roles: [ { role: “readWrite”, db: “cmdb” } ]})

4. 部署Elasticsearch 

官方下载 ElasticSearch 推荐下载5.0.2, 5.6.16

https://www.elastic.co/cn/downloads/past-releases/elasticsearch-5-6-16

vim config/elasticsearch.yml

network.host: 10.26.27.222

临时修改内核参数sysctl -w vm.max_map_count=262144

永久:在/etc/sysctl.conf文件最后添加一行:vm.max_map_count=262144,重启

不能使用root权限运行,要普通用户

chown -R matrix:matrix

./elasticsearch

5. 部署mongo-connector 

官方仓库 Mongo-connector 推荐使用pip安装:

mongo-connector supports Python 3.4+ and MongoDB versions 3.4 and 3.6.

pip install elastic2-doc-manager elasticsearch

pip install ‘mongo-connector[elastic5]’

注意:python elasticsearch大版本要和下载的elasticsearch一致

vim config.json

{
    "__comment__": "Configuration options starting with '__' are disabled",
    "__comment__": "To enable them, remove the preceding '__'",


    “mainAddress”: “127.0.0.1:27017”,

    “oplogFile”: “/data0/cmdb/mongo-connector/oplog.timestamp”,

    “noDump”: false,

    “batchSize”: -1,

    “verbosity”: 3,

    “continueOnError”: true,

    “logging”: {

        “type”: “file”,

        “filename”: “/data0/cmdb/mongo-connector/mongo-connector.log”,

        “format”: “%(asctime)s [%(levelname)s] %(name)s:%(lineno)d – %(message)s”,

        “rotationWhen”: “D”,

        “rotationInterval”: 1,

        “rotationBackups”: 10,

        “__type”: “syslog”,

        “__host”: “localhost:514”

    },

    “__authentication”: {

        “adminUsername”: “cc”,

        “password”: “cc”,

        “__passwordFile”: “mongo-connector.pwd”

    },

    “__fields”: [“field1”, “field2”, “field3”],

    “exclude_fields”: [“create_time”, “last_time”],

    “namespaces”: {

        “cmdb.cc_HostBase”: true,

        “cmdb.cc_ObjectBase”: true,

        “cmdb.cc_ObjDes”: true,

        “cmdb.cc_ApplicationBase”: true,

        “cmdb.cc_OperationLog”: false

    },

    “docManagers”: [

        {

            “docManager”: “elastic2_doc_manager”,

            “targetURL”: “127.0.0.1:9200”,

            “__bulkSize”: 1000,

            “uniqueKey”: “_id”,

            “autoCommitInterval”: 0

        }

    ]

}

mongo-connector -c config.json

6. 部署CMDB

下载包,注意下载cmdb_oss_v3.5.23.tgz

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

MongoDB 从3.6开始更改了默认加密方式,所以如果安装的MongoDB的版本大于等于3.6,先修改init.py,配置文件mongodb小节增加mechanism 配置[mongodb]

host=127.0.0.1

usr=cc

pwd=cc

database=cmdb

port=27017

maxOpenConns=3000

maxIDleConns=1000

mechanism=SCRAM-SHA-1

python init.py –discovery 127.0.0.1:2181 –database cmdb –redis_ip 127.0.0.1 –redis_port 6379 –redis_pass gaoyaohua –mongo_ip 127.0.0.1 –mongo_port 27017 –mongo_user cc –mongo_pass cc –blueking_cmdb_url http://10.26.27.222:8088/ –blueking_paas_url http://paas.domain.com –listen_port 8088 –auth_scheme internal –auth_enabled false –full_text_search off –es_url http://10.26.27.222:9200 –log_level 3

./start.sh

如果process count should be: 11 , now: 11 这里显示不全,不能执行后边,先排错

初始化数据

./init_db.sh

./stop.sh

发表评论

电子邮件地址不会被公开。 必填项已用*标注