欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

elasticsearch集群部署

程序员文章站 2022-06-01 12:44:31
...
启动elk:

zjtest7-redis:/usr/local/elasticsearch-2.3.4/bin# ./elasticsearch -d 后台运行



访问;

http://192.168.32.80:9200/

{
  "name" : "node01",
  "cluster_name" : "es_cluster",
  "version" : {
    "number" : "2.3.4",
    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
    "build_timestamp" : "2016-06-30T11:24:31Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}


Elasticsearch 目录结构:


文件夹                   作用

/bin                     运行ElasticSearch实例和管理插件的一些脚本
[[email protected] bin]$ ls -ltr
total 324
-rw-rw-r-- 1 elk elk  80896 Jan 27  2016 elasticsearch-service-x86.exe
-rw-rw-r-- 1 elk elk 103936 Jan 27  2016 elasticsearch-service-x64.exe
-rw-rw-r-- 1 elk elk 104448 Jan 27  2016 elasticsearch-service-mgr.exe
-rw-rw-r-- 1 elk elk   6501 Jun 30 19:22 service.bat
-rw-rw-r-- 1 elk elk   1303 Jun 30 19:22 plugin.bat
-rwxr-xr-x 1 elk elk   2992 Jun 30 19:22 plugin
-rwxr-xr-x 1 elk elk   2814 Jun 30 19:22 elasticsearch.in.sh
-rw-rw-r-- 1 elk elk   3307 Jun 30 19:22 elasticsearch.in.bat
-rw-rw-r-- 1 elk elk    909 Jun 30 19:22 elasticsearch.bat
-rwxr-xr-x 1 elk elk   5551 Jun 30 19:22 elasticsearch



/config 配置文件路径,包含elasticsearch.yml

/data    在节点上每个索引/碎片 的数据文件的位置,可以多个目录

[[email protected] config]$ cat elasticsearch.yml 

cluster.name: es_cluster
node.name: node01
path.data: /elk/elasticsearch/data
path.logs: /elk/elasticsearch/logs
network.host: 192.168.32.80
network.port: 9200



3.2 Elasticsearch 相关插件;

1. Head 插件介绍

2. Bigdesk插件介绍

head 插件是一个elasticsearch的集群管理工具,它是完全由html5编写的独立网页程序



安装插件:

[email protected] elasticsearch-2.3.4]$ ./bin/plugin install mobz/elasticsearch-head 


-> Installing mobz/elasticsearch-head...  


http://192.168.32.80:9200/_plugin/head/


Bigdesk 插件是elasticsearch 的一个集群监控工具,可以通过它来查看集群的各种状态,如:

cpu,内存,使用情况,索引数据,搜索情况,http连接数等。



[[email protected] bin]$ ./plugin  install lukas-vlcek/bigdesk/2.5.0




在部署一台 192.168.32.81:

启动[[email protected] bin]$ ./elasticsearch -d
[[email protected] bin]$ 



http://192.168.32.81:9200/


{
  "name" : "node02",
  "cluster_name" : "es_cluster",
  "version" : {
    "number" : "2.3.4",
    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",
    "build_timestamp" : "2016-06-30T11:24:31Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  },
  "tagline" : "You Know, for Search"
}


配置文件:

cluster.name: es_cluster
node.name: node02
path.data: /elk/elasticsearch/data
path.logs: /elk/elasticsearch/logs
network.host: 192.168.32.81
network.port: 9200
discovery.zen.ping.unicast.hosts: ["192.168.32.80", "192.168.32.81"]


discovery.zen.ping.unicast.hosts: ["192.168.80.10", "192.168.80.20"]
位于配置文件的第79行,用于定义elasticsearch发送广播的ip,默认情况下向elasticsearch所在网段的所以ip进行广播



默认会同步数据



[[email protected] plugins]$ ls
[[email protected] plugins]$