1. 安装 elasticsearch
- 安装elasticsearch的唯一条件是必须安装 java 运行环境
- 下载最新版本的 elasticsearch
安装marvel
marvel 为 elasticsearch 的集群监控工具
直接从互联网下载安装:
bin/plugin -i elasticsearch/marvel/lastest
上面一种方法可能会因为网络原因安装失败,可以指定文件安装:
➜ elasticsearch bin/plugin -i elasticsearch/marvel/lastest -u file:///home/jeffor/space/package/marvel-latest.zip -> Installing elasticsearch/marvel/lastest... Trying file:/home/jeffor/space/package/marvel-latest.zip... Downloading ....................DONE Installed elasticsearch/marvel/lastest into /home/jeffor/space/apps/elasticsearch/plugins/marvel
若不想 marvel 监控elasticsearch 集群,可以配置如下:
echo 'marvel.agent.enabled: false' >> ./config/elasticsearch.yml
marvel 在开发中使用是免费的,但是生产环境需要购买版权。可以使用其他的监控插件代替,如
bigdesk, head
2. 启动和关闭
启动在前台:
./bin/elasticsearch
对于启动在前台的服务 使用 ctl + c 即可关闭服务
启动在后台:
./bin/elasticsearch -d
使用marvel监控集群:
在浏览器中打开
http://localhost:9200/_plugin/marvel
关闭 elasticsearch 服务:
curl -XPOST "http://localhost:9200/_shutdown"
3. elasticsearch-servicewrapper 安装和使用
- elasticsearch-servicewrapper 是 elasticsearch 服务的启动管理工具,能实现注册系统服务,快速启动关闭,非常方便。
安装和使用:
- 下载elasticsearch-servicewrapper
- 将 elasticsearch-servicewrapper 中的 server 目录拷贝到 ES_HOME/bin/下
使用:
➜ elasticsearch ./bin/service/elasticsearch –help
Unexpected command: –helpUsage: ./bin/service/elasticsearch [ console | start | stop | restart | condrestart | status | install | remove | dump ]
Commands:
console Launch in the current console.
start Start in the background as a daemon process.
stop Stop if running as a daemon or in another console.
restart Stop if running and then start.
condrestart Restart only if already running.
status Query the current status.
install Install to start automatically when system boots.
remove Uninstall.
dump Request a Java thread dump if running.