Linux教程

Linux下Monstache 6.X安装配置(图文详细)

本文主要是介绍Linux下Monstache 6.X安装配置(图文详细),对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

Linux下Monstache 6.X安装配置(图文详细)

一、资源准备

  • 资源下载地址: https://github.com/rwynn/monstache
    在这里插入图片描述

二、版本关系

在这里插入图片描述

三、安装配置

  • 上传资源
# 上传文件至soft目录

#切换目录并解压
cd /opt/soft
unzip monstache-rel6.zip -d /opt/module/

#切换目录并查看
cd /opt/module/monstache-rel6/ && ll

在这里插入图片描述

  • 执行安装
#安装命令
go install

在这里插入图片描述

  • 查看安装文件
#查看命令
cd /opt/GP/bin/ && ll

在这里插入图片描述

  • 创建配置目录
#切换并创建存储目录
cd /opt/module/monstache-rel6 && mkdir -p repo/logs repo/conf && ll

在这里插入图片描述

  • 编辑配置文件
#编辑命令
cd /opt/module/monstache-rel6/repo/conf && vim config.toml

#文件内容
# cmdb connection settings

# connect to MongoDB using the following URL
mongo-url =  "mongodb://用户:密码@IP:PORT/数据库名称"
# connect to the Elasticsearch REST API at the following node URLs
elasticsearch-urls = ["http://IP:PORT"]

# frequently required settings

# if you need to seed an index from a collection and not just listen and sync changes events
# you can copy entire collections or views from MongoDB to Elasticsearch
direct-read-namespaces = ["roo.cc_ApplicationBase"]

# if you want to use MongoDB change streams instead of legacy oplog tailing use change-stream-namespaces
# change streams require at least MongoDB API 3.6+
# if you have MongoDB 4+ you can listen for changes to an entire database or entire deployment
# in this case you usually don't need regexes in your config to filter collections unless you target the deployment.
# to listen to an entire db use only the database name.  For a deployment use an empty string.
change-stream-namespaces = ["roo.cc_ApplicationBase"]

# additional settings

# compress requests to Elasticsearch
gzip = true
# use the following user name for Elasticsearch basic auth
elasticsearch-user = ""
# use the following password for Elasticsearch basic auth
elasticsearch-password = ""
# use 4 go routines concurrently pushing documents to Elasticsearch
elasticsearch-max-conns = 4 
# propagate dropped collections in MongoDB as index deletes in Elasticsearch
dropped-collections = true
# propagate dropped databases in MongoDB as index deletes in Elasticsearch
dropped-databases = true
# resume processing from a timestamp saved in a previous run
resume = true
# do not validate that progress timestamps have been saved
resume-write-unsafe = false
# override the name under which resume state is saved
resume-name = "default"
# use a custom resume strategy (tokens) instead of the default strategy (timestamps)
# tokens work with MongoDB API 3.6+ while timestamps work only with MongoDB API 4.0+
resume-strategy = 0
# print detailed information including request traces
verbose = true

# mapping settings

[[mapping]]
namespace = "roo.cc_ApplicationBase"
index = "roo.cc_applicationbase"
  • 配置自启
#切换目录
cd /etc/init.d

#编辑命令
vim monstache

#脚本内容
#!/bin/bash
#
# chkconfig: 2345 10 90
#
# description: MONSTACHE RUN

#程序名
MONSTACHE_NAME="monstache-rel6"

#资源位置
MONSTACHE_OPTS=/opt/GP/bin/monstache
MONSTACHE_CONF=/opt/module/monstache-rel6/repo/conf/config.toml

#日志位置
MONSTACHE_LOGS=/opt/module/monstache-rel6/repo/logs/monstache.log

#开始方法
start() {
        nohup $MONSTACHE_OPTS -f $MONSTACHE_CONF > $MONSTACHE_LOGS  2>&1 &
        echo "$MONSTACHE_NAME started success."
}

#结束方法
stop() {
        echo "stopping $MONSTACHE_NAME ..."
        kill -9 `ps -ef|grep $MANSTACHE_OPTS|grep -v grep|grep -v stop|awk '{print $2}'`
}

case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        restart)
            stop
            start
            ;;
        *)
                echo "Userage: $0 {start|stop|restart}"
                exit 1
esac

#授权
chmod +x monstache 

#添加系统服务
chkconfig --add monstache
chkconfig monstache on
chkconfig --list

在这里插入图片描述

  • 启停相关
#启停命令
systemctl start|stop|restart monstache

#查看进程
ps -ef|grep monstache

在这里插入图片描述

  • 到此、配置完成。
这篇关于Linux下Monstache 6.X安装配置(图文详细)的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!