参考:

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 pip源处理

    pypi 镜像使用帮助 pypi 镜像每 5 分钟同步一次. 临时使用 pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-pac ...

  2. element ui中dialog相关问题

    一,今天需要在dialog里面引入另一个页面,就是打开dialog显示该页面(把页面放到dialog中),引入的语句如下: <iframe src="view?path=rkdj_b& ...

  3. linux下的环境变量配置

    方法一: 方法二:

  4. CRM 2016 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089"类型的权限已失败.

    CRM 请求"System.Security.Permissions.FilelOPermission,mscorlib,Version=4.0.0.0,Culture=neutral,Pu ...

  5. SSH 项目整合

    SSH整合:spring + springmvc + hibernate 1.1 生成Maven项目:ar_ssh 1.2 添加jar包:pom.xml 与ssm相比,主要添加了spring与hibe ...

  6. (转)C#操作Word文档

    原文1地址:http://www.cnblogs.com/lantionzy/archive/2009/10/23/1588511.html 原文2地址: http://www.cnblogs.com ...

  7. IntelliJ IDEA 版本控制器 - Git

    1.下载Git 2.测试Git是否安装成功 3.设置 本机 Git 标识,同时解决未设置标识产生的错误 Successfully created project 'demo' on GitHub, b ...

  8. scrapy框架之日志等级和请求传参-cookie-代理

    一.Scrapy的日志等级 - 在使用scrapy crawl spiderFileName运行程序时,在终端里打印输出的就是scrapy的日志信息. - 日志信息的种类: ERROR : 一般错误 ...

  9. C,C#,Java:枚举类型

    #include <stdio.h> main() { // 枚举默认从0开始,这里指定为1起头 , Tues, Wed, Thurs, Fri, Sat, Sun } day; scan ...

  10. mapreduce运行原理及YARN

    mapreduce1回顾 mapreduce1的不足 yarn的基本架构 yarn工作流程