Elasticsearch 在linux中的安装和使用

1.es的安装

1.1 es工具安装

参考安装步骤如下:https://blog.csdn.net/sinat_28224453/article/details/51134978

安装地址: 192.168.1.14,   192.168.1.16, 192.168.1.17

Wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.3.tar.gz

Tar –xvf  elasticsearch-1.7.3.tar.gz

修改 config  目录下的 elasticsearch.yml文件

38上修改如下: (39 修改 “es-node2” ,地址全部修改为:192.168.1.39)

cluster.name:oss20-es

node.name:"es-node01"

index.number_of_shards:5

扫描二维码关注公众号,回复: 2925754 查看本文章

index.number_of_replicas:1

path.conf:/home/es/elasticsearch-1.7.0/config

path.data:/data/elasticsearch/data,/home/es/elasticsearch-1.7.0/data

path.work:/home/es/elasticsearch-1.7.0/work

path.logs:/home/es/elasticsearch-1.7.0/logs

path.plugins:/home/es/elasticsearch-1.7.0/plugins

network.bind_host:192.168.1.14

network.publish_host:192.168.1.14

network.host:192.168.1.14

transport.tcp.port:9100

http.port: 9200

http.max_content_length:100mb

http.enabled:true

discovery.zen.minimum_master_nodes:2

discovery.zen.ping.timeout:30s

discovery.zen.ping.multicast.enabled:true

discovery.zen.ping.unicast.hosts:["192.168.1.14:9100","192.168.1.16:9100","192.168.1.17:9100"]

15节点:node.name: "es-node02"  地址全改为本机地址 其他不变

16节点:

node.name:"es-node02" 

node.master:false

node.data: true

地址全改为本机地址。其他不变

后台启动:

./elasticsearch –d

命令行输入: curl localhost:9200   status200 表明正常启动

浏览器输入: http://localhost:9200  看到状态信息,表示正常启动

关闭:

前台运行: 使用  ctrl+c 停止

后台运行: 使用kill -9 进程好 停止

1.2安装插件::

参考链接如下:

https://www.iyunv.com/forum.php?mod=viewthread&tid=144361

1.2. 1 bigdesk 插件

bigdeskelasticsearch的一个集群监控工具,可以通过它来查看es集群的各种状态,如:cpu、内存使用情况,索引数据、搜索情况,http连接数等

./bin/plugin –installlukas-vlcek/bigdesk

浏览器打开:  http://192.168.1.14:9200/_plugin/bigdesk/

或者通过方法2下载安装插件:
1.https://github.com/lukas-vlcek/bigdesk下载zip解压
2.建立elasticsearch-1.0.0\plugins\bigdesk\_site文件
3.将解压后的bigdesk-master文件夹下的文件copy_site
4.运行es
5.打开http://localhost:9200/_plugin/bigdesk/ 

1.2.2. head插件

elasticsearch-head是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序,你可以通过插件把它集成到es

./plugin –installmobz/elasticsearch-head

安装成功之后会在    ../plugins目录下有该插件目录

在浏览器中访问:

http://192.168.1.14:9200/_plugin/head/

 

安装过程参考:

https://blog.csdn.net/gongzi2311/article/details/51699798

2 . es的使用

查看es中存在的索引

curl -XCAT 'localhost:9200/_cat/indices?v'

curl 'localhost:9200/_cat/indices?v'

创建customer  索引

curl -XPUT 'localhost:9200/customer?pretty'

猜你喜欢

转载自blog.csdn.net/qq_33124081/article/details/80804740