参考:

https://blog.csdn.net/u014180504/article/details/78733827

https://blog.csdn.net/youzhouliu/article/details/78885897

——————————————————————————————————————————————

为了避免踩坑,先解决以下问题

1.  不要用root用户,搭建 ES

2.  为了避免   这个错误   max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

需要 [root@localhost config]# vim /etc/security/limits.conf

添加以下内容:

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

我是root用户添加的,要想生效,需要退出用户,重新进入才行(普通用户重新进入才生效)。

3. 为了避免  max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

需要在: /etc/sysctl.conf  文件里  set vm.max_map_count=262144

我设置的是:

4. 机器要安装jdk 1.8+

-----------------------------------------------------

单机安装:

1. 下载 ,url:https://www.elastic.co/downloads/elasticsearch

2. 上传centos,解压

tar zxvf elasticsearch-6.5.0.tar.gz

3. 配置 config/elasticsearch.yml文件

在 文件末尾添加如下配置:

4. 启动: ./bin/elasticsearch

[2018-11-19T10:55:24,935][INFO ][o.e.n.Node               ] [es-master] started     说明启动成功

5.浏览器访问  http://192.168.1.157:9200/      注意9200对外开放端口

-----------------------------------------------

安装head插件

1. 下载地址: https://github.com/mobz/elasticsearch-head

上传, 并 tar -zxvf  解压

2. 运行head需要运行node所以也要下载node           https://npm.taobao.org/mirrors/node/latest-v10.x/

上传,并 unzip 解压

3.  在  /etc/profile 中添加

修改完保存并

source /etc/profile
1
这里遇到了大坑啊,由于ES启动时不建议用root账户的所以我直接用其他的账户登录之后修改,但是不让改没权限,然后我就切换到root修改也source 了,但是在切换回其他账户的时候

echo $NODE_HOME
1
死活是空的,我就纳闷了,在看也修改了,这里就埋下了坑,就直接说解决方案吧,哭死了,必须在用当前账户在 source /etc/profile一次才行,在

echo $NODE_HOME

安装grunt

接下来解压下载的master.zip,进入下载的elasticsearch-head-master,
执行

[root@localnode1 elasticsearch-head-master]#npm install -g grunt-cli
1
接下来检查grunt 安装是否成功

[root@localnode1 elasticsearch-head]# grunt -version
grunt-cli v1.3.2
输出版本说明成功

修改head插件源码:

修改服务器监听地址:Gruntfile.js

修改修改连接地址:_site/app.js

在elasticsearch-head-master目录下

[root@localnode1 elasticsearch-head]# npm install
[root@localnode1 elasticsearch-head]# grunt server

启动成功就可以访问192.168.1.157:9100就可以看到如下界面

----------------------------------------------

伪集群搭建:

1. 把解压的elasticsearch-6.5.0, 复制三份, 分别为es-node1,es-node2,es-node3

[es@localhost es-node1]$ vim config/elasticsearch.yml

cluster.name: elasticsearch

node.name: es-node1

network.host: 192.168.1.157

http.port: 9200

discovery.zen.ping.unicast.hosts: ["192.168.1.157","192.168.1.157:9301"]

discovery.zen.minimum_master_nodes: 2

network.bind_host: 192.168.1.157
#设置绑定的ip地址,这是master虚拟机的IP
#
# network.publish_host: 192.168.1.157
# #设置其它节点和该节点交互的ip地址
transport.tcp.port: 9300

http.cors.enabled: true
http.cors.allow-origin: "*"

[es@localhost es-node2]$ vim config/elasticsearch.yml

cluster.name: elasticsearch

node.name: es-node2

network.host: 192.168.1.157

http.port: 9201

discovery.zen.ping.unicast.hosts: ["192.168.1.157","192.168.1.157:9301"]

discovery.zen.minimum_master_nodes: 2

network.bind_host: 192.168.1.157
#设置绑定的ip地址,这是master虚拟机的IP
#
# network.publish_host: 192.168.1.157
# #设置其它节点和该节点交互的ip地址
transport.tcp.port: 9301

[es@localhost es-node3]$ vim config/elasticsearch.yml

cluster.name: elasticsearch

node.name: es-node3

network.host: 192.168.1.157

http.port: 9202

discovery.zen.ping.unicast.hosts: ["192.168.1.157","192.168.1.157:9301"]

discovery.zen.minimum_master_nodes: 2

network.bind_host: 192.168.1.157
#设置绑定的ip地址,这是master虚拟机的IP
#
# network.publish_host: 192.168.1.157
#设置其它节点和该节点交互的ip地址
transport.tcp.port: 9302

第一步,修改elasticsearch-head下Gruntfile.js文件,内容如下:

1
2
3
4
5
6
7
8
9
10
connect: {
    server: {
        options: {
            hostname: '0.0.0.0',
            port: 9100,
            base: '.',
            keepalive: true
        }
    }
}

第二步,修改elasticsearch-head\_site\app.js 文件。this.base_uri 改为下面的值。

1
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.157:9200";

最后一般,在 elasticsearch.yml  中追加下面的内容。

1
2
http.cors.enabled: true
http.cors.allow-origin: "*"

然后重启 elasticsearch ,访问 http://xxxx:9100/ 就可以成功的连接上 9200 端口。

ElasticSearch centos7 安装的更多相关文章

  1. Centos7安装elasticsearch、logstash、kibana、elasticsearch head

    环境:Centos7, jdk1.8 安装logstash 1.下载logstash 地址:https://artifacts.elastic.co/downloads/logstash/logsta ...

  2. Centos7部署elasticsearch并且安装ik分词以及插件kibana

    第一步 下载对应的安装包 elasticsearch下载地址:https://www.elastic.co/cn/downloads/elasticsearch ik分词下载:https://gith ...

  3. centos7 安装 elasticsearch

    安装java环境 这里使用yum方式安装,前提是必须有网络 yum install java-1.8.0-openjdk 安装完成,查看java版本 [root@localhost ~]# java ...

  4. elasticsearch安装与使用(2)-- centos7 安装测试的集群工具elasticsearch head

    elasticsearch-head是elasticsearch(下面称ES)比较普遍使用的可监控.测试等功能的集群管理工具,是由H5编写的单独的网页程序.使用方法网上很多,这里教大家一个超简单安装h ...

  5. ES系列一、CentOS7安装ES 6.3.1、集成IK分词器

    Elasticsearch 6.3.1 地址: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3. ...

  6. centos7安装elasticsearch-head

    elasticsearch-head安装前准备 1.操作系统64位CentOS Linux release 7.2.1511 (Core)2.git是必需的elasticsearch-head是一款开 ...

  7. centos7安装elasticsearch5.2.2

    这篇文章比较初级,介绍的是centos7下elasticsearch的安装. 主要阅读对象是初级运维.初级大数据工程师.java工程师.想了解es的.net工程师以及所有感兴趣的朋友. 文章的目的是为 ...

  8. 【elasticsearch】安装合集

    [elasticsearch](1)centos7 使用yum安装elasticsearch 2.X [elasticsearch](2)centos7 超简单安装elasticsearch 的监控. ...

  9. elasticsearch 7 安装

    elasticsearch 安装 操作系统:CentOS Linux release 7.4 elasticsearch:elasticsearch-7.1.1 es7+centos7 1.软件下载 ...

随机推荐

  1. python面向对象 : 抽象类(接口类),多态,封装(私有制封装)

    一. 抽象类(接口类) 与java一样, python也有抽象类的概念但是同样需要借助模块实现,抽象类是一个特殊的类, 它的特殊之处在于只能被继承, 不能被实例化. 从设计角度去看, 如果类是从现实对 ...

  2. [UE4]Set Array Elem

    用一个新元素替换数组中已有的元素. “Size to Fit”:true,表示如果index参数大于数组所有,将会自动扩展数组大小.

  3. [UE4]传送门:场景切换

  4. PHP升级7.2之后需要注意的事情

    最近升级了PHP版本,从7.1升级到7.2,升级前版本: PHP 7.1.14 (cli) (built: Feb 2 2018 08:42:59) ( NTS ) Copyright (c) 199 ...

  5. UI 性能因素考虑

    浏览器的最大并发连接数一般在4到6之间,首先了解影响加载的性能因素: (1)下载的文件太大 (2)发出的请求太多 (3)请求相应不及时 针对这些因素,一般会考虑减少请求次数: (1)对静态文件设置缓存 ...

  6. 0000 - Spring Cloud 概述

    1.概述 Spring Cloud是一系列框架的有序集合,它利用Spring Boot的开发便利性简化了分布式系统的开发,比如服务发现.服务网关.服务路由.链路追踪等.Spring Cloud并不重复 ...

  7. vue808

    自定义键盘信息:    Vue.directive('on').keyCodes.ctrl=17;    Vue.directive('on').keyCodes.myenter=13; 数据深度监听 ...

  8. java下载excel,excel从数据库获取数据

    <!-- poi --> <dependency> <groupId>org.apache.poi</groupId> <artifactId&g ...

  9. sed初学者实用说明

     转自:http://www.codeweblog.com/sed%E5%88%9D%E5%AD%A6%E8%80%85%E5%AE%9E%E7%94%A8%E8%AF%B4%E6%98%8E/ ...

  10. python脚本参数传递

    环境:python 库:optparse 效果:python  xxx.py  -parameter1  参数1  -parameter2 参数2 .... 废话少说,直接上代码ok?  xxx.py ...