macOS 自用的命令集合

2018/8/21 源自  macOS

安装 elasticsearch

# 更新 brew
$ brew update
# 修改formula
$ cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
$ git checkout 5874ac8c8fab69f8a714d643581e489bcb176d92 elasticsearch@5.6.rb
# 安装
$ brew install elasticsearch@5.6
# 查看
$ brew info elasticsearch@5.6
# 锁定版本, 防止被误升级
$ brew pin elasticsearch@5.6
# 安装ik
$ cd /usr/local/Cellar/elasticsearch@5.6/5.6.4
$ bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v5.6.4/elasticsearch-analysis-ik-5.6.4.zip

配置 elasticsearch

# /usr/local/etc/elasticsearch/elasticsearch.yml
cluster.name: 集群名字
node.name: 节点名
path.data: 数据存储目录
path.logs: 日志存储目录
action.auto_create_index: false

使用 elasticsearch

# 查看状态
$ brew services list
# 启动/重启/停止
$ brew services start elasticsearch@5.6
$ brew services restart elasticsearch@5.6
$ brew services stop elasticsearch@5.6

1、启动 elasticsearch-head
/usr/local/Cellar/elasticsearch-head/node_modules/grunt/bin/grunt server

2、启动 elasticsearch
brew services restart elasticsearch