Database

Mac OSX 환경에서 Monstache와 MongoDB 연동하기

kogun82 2022. 2. 4. 22:17

GO 설치
다운로드: https://go.dev/dl/
소스 설치: https://go.dev/doc/install/source

Go 설치
To build the Go distribution, run 명령어

$ cd src
$ ./all.bash


brew 설치 명령어

brew install golang


go 설치 환경 확인 명령어

go env

 

환경 변수 추가

export GOROOT=/usr/local/Cellar/go/1.17.6/libexec
export GOPATH=/Users/kogun82/go
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOPROXY=https://proxy.golang.org,direct


Monstache 설치

brew install coreutils
git clone https://github.com/rwynn/monstache.git
cd monstache
go install
make
cd build/darwin-amd64
monstache -v


실행 명령어

monstache -f /Users/kogun82/storage/monstache/config.toml
nohup monstache -f /Users/kogun82/storage/monstache/config.toml 2>&1 &


설정 변경

# connection settings 
mongo-url = "mongodb://localhost:27017"
elasticsearch-urls = ["http://localhost:9200"]
direct-read-namespaces = ["kobic.bio_project"]
change-stream-namespaces = ["kobic.bio_project"]
file-namespaces = ["bio_project"]

# namespace-regex = '^kobic\.bio_$'
# namespace-exclude-regex = '^mydb\.ignorecollection$'
gzip = true
stats = true
index-stats = true
replay = false
resume-strategy = 1
elasticsearch-max-conns = 4
elasticsearch-max-seconds = 5
elasticsearch-max-bytes = 8000000
dropped-collections = false
dropped-databases = false
resume = true
resume-write-unsafe = true
resume-name = "default"
index-files = false
file-highlighting = false
verbose = true
exit-after-direct-reads = false
index-as-update=true
index-oplog-time=true

[logs]
info = "/BiO/storage/monstache/logs/info.log"
warn = "/BiO/storage/monstache/logs/warn.log"
error = "/BiO/storage/monstache/logs/error.log"
trace = "/BiO/storage/monstache/logs/trace.log"
반응형