elasticSearch
(1)下载,解压
(2)进入config目录修改elasticsearch.yml
#配置es的集群名称,默认是elasticsearch,es会自动发现在同一网段下的es,如果在同一网段下有多个集群,就可以用这个属性来区分不同的集群。 cluster.name: shorturl #节点名称 node.name: node-1 #设置索引数据的存储路径 path.data: /home/aj_viewas/es/data #设置日志的存储路径 path.logs: /home/aj_viewas/es/logs #设置当前的ip地址,通过指定相同网段的其他节点会加入该集群中 network.host: 172.21.2.12 #设置对外服务的http端口 http.port: 9200
(3)启动
进入bin目录
./elasticsearch
若要后台运行执行./elasticsearch -d
(4)验证
浏览器访问上述ip和端口
(5)重启
ps -ef |grep elastic
kill -9 pid
重复(3)
(6)常用命令(可安装管理工具进行管理及查看)
curl -XGET 'http://172.21.2.12:9200/_nodes/stats?pretty=true'
查看索引:curl -XGET 'http://172.21.2.12:9200/_cat/indices?v&pretty'
插入索引:curl -XPUT '172.21.2.12:9200/link?pretty'
删除索引:curl -XDELETE '172.21.2.12:9200/link?pretty'
------------------------------------------------------------------------------------------------
查看mapping:curl -XGET 'http://172.21.2.12:9200/link/_mapping'
插入mapping:curl -X PUT 172.21.2.12:9200/link/_mapping -d '{"properties": {"originalUrl": {"type": "text"},"shortUrl": {"type": "text"},"appId": {"type": "text"},"createTime": {"type": "date"}}}'
(7)管理工具安装(kibana/cerebro)
以下以cerebro为例(个人觉得更好用)
1.下载解压
https://github.com/lmenezes/cerebro/releases
2.启动
进入bin目录
执行./cerebro
默认端口是9000,如需修改端口可在application.conf中修改,或者指定端口启动./cerebro -Dhttp.port=8080
后台启动:nohup ./cerebro &

浙公网安备 33010602011771号