0. 首先需要安装jdk,因为elasticsearch是Java写的,默认需要Java环境,且安装elasticsearch 7.x需要使用jdk 1.8或更高版本

1. 执行以下命令,创建elasticsearch仓库(计划安装7.x版本的elasticsearch)

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-.x]
name=Elasticsearch repository for .x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=
autorefresh=
type=rpm-md
EOF

2. 建立elasticsearch仓库之后,需要刷新yum索引

sudo yum clean all
sudo yum makecache

3. 安装elasticsearch

sudo yum -y install elasticsearch-oss

4. 编辑文件: /etc/elasticsearch/jvm.options, 设置内存大小:

默认是:-Xms1g -Xmx1g

可以设置为:-Xms256m -Xmx512m

5. 启动elasticsearch

sudo systemctl enable --now elasticsearch.service 

使用如下命令也可以启动

/etc/init.d/elasticsearch start

6. 检验一下是否启动起来了

[root@localhost ~]# curl http://localhost:9200
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Ybtkma76SSKOmXw89fMnuQ",
"version" : {
"number" : "7.3.2",
"build_flavor" : "oss",
"build_type" : "rpm",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@localhost ~]# curl http://127.0.0.1:9200
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Ybtkma76SSKOmXw89fMnuQ",
"version" : {
"number" : "7.3.2",
"build_flavor" : "oss",
"build_type" : "rpm",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@localhost ~]#

7. 目前只可以在服务器上使用127.0.0.1与localhost进行访问,如果需要对elasticsearch使用公网访问,还需要将elasticsearch.yum配置添加如下内容:

network.host: 0.0.0.0
http.port:
http.cors.enabled: true
http.cors.allow-origin: "*"
cluster.initial_master_nodes: ["node-1"]

8. 服务器上访问结果:

[root@localhost elasticsearch]# curl http://192.168.1.27:9200/
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Ybtkma76SSKOmXw89fMnuQ",
"version" : {
"number" : "7.3.2",
"build_flavor" : "oss",
"build_type" : "rpm",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}

本地访问结果

C:\Users\YFZX-MY->curl http://192.168.1.27:9200
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "Ybtkma76SSKOmXw89fMnuQ",
"version" : {
"number" : "7.3.2",
"build_flavor" : "oss",
"build_type" : "rpm",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
} C:\Users\YFZX-MY->

9. 配置过程中,启动elasticsearch怎么着都启动不起来,去看了启动日志(日志文件位置再elasticsearch.yum文件中有描述),报错如下:

[localhost.localdomain] no plugins loaded
[--19T02::,][INFO ][o.e.d.DiscoveryModule ] [localhost.localdomain] using discovery type [zen] and seed hosts providers [settings]
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
[--19T02::,][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {192.168.1.27:}, bound_addresses {[::]:}
[--19T02::,][INFO ][o.e.b.BootstrapChecks ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
[--19T02::,][ERROR][o.e.b.Bootstrap ] [localhost.localdomain] node validation exception
[] bootstrap checks failed
[]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] stopping ...
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] stopped
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] closing ...
[--19T02::,][INFO ][o.e.n.Node ] [localhost.localdomain] closed

去elasticsearch.yum文件里面添加:

#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["node-1"] 这个的话,这里的node-1是上面一个默认的记得打开就可以了

RedHat linux服务器安装elasticsearch且设置公网访问的更多相关文章

  1. RedHat Linux下iptables防火墙设置

    一般情况下iptables已经包含在Linux发行版中.运行 # iptables --version 来查看系统是否安装iptables 启动iptables:# service iptables ...

  2. 实现Redhat Linux 6和Windows通过Windows Server AD统一认证并共享访问Oracle ZS存储系统

    Windows Server 2012 AD设置 1.  建立新的组织单位OU 为用户提前建立好OU,是为了AD用户管理简单清晰. 2.  建立新的用户和用户组 建立新的用户的时候,要同时将用户归属到 ...

  3. linux服务器安装mysql并配置外网访问

    linux服务器安装mysql并配置外网访问 更新系统,如果不运行该命令,直接安装mysql,会出现"有几个软件包无法下载 sudo apt-get update 安装mysql sudo ...

  4. 解决CentOS6.x或RedHat Linux 6.x版本不能通过System eth0以固定IP访问外网的问题

    当你在VMware Workstation Pro中,打开从别人那里克隆来的系统,或者是开启迁移后的虚拟机系统时,VMware将会提示你:此虚拟机可能已被移动或 复制.为了配置特定的管理和网络功能.V ...

  5. 在Linux系统中如何设置APACHE服务器里的后台页面只允许某个IP地址访问

    补充资料 本网络中使用LINUX服务器,web服务器是由APACHE搭建,IP地址为192.168.1.5,后台页面为/admin/login.jsp . 如何设置后台页面LOGIN.JSP只允许19 ...

  6. linux 搭建ftp服务并设置限制访问目录

    服务器有好几个项目,新项目前端外包,因为要微信授权登陆,所以前端没有办法本地调试,必须上次ftp在我们服务器上调试代码,当然要限制ftp访问的目录,否则整个服务器项目都能看到了. 安装vsftpd s ...

  7. 阿里云mysql数据库设置让公网访问客户端访问

    第一步 首先使用root登入你的mysql ./mysql -u root -p 你的密码 第二步 备注:也可以添加一个用户名为yuancheng,密码为123456,权限为%(表示任意ip都能连接) ...

  8. NO2:设置RedHat Linux下的samba开机启动

    安装的samba默认不是开机启动的,这样每次都要进入系统人为启动,很不方便,当然系统肯定可以设置开机启动的. 因为我的是RedHat Linux系统,支持chkconfig命令直接配置,会简单些,其它 ...

  9. Linux 安装MongoDB 并设置防火墙,使用远程客户端访问

    1. 下载 MongoDB 提供了 linux 各发行版本 64 位的安装包  下载地址:https://www.mongodb.com/download-center#community 2. 安装 ...

随机推荐

  1. 四、Hexo静态博客绑定域名及域名解析

    示例: http://zsy.xyz/ 域名准备 ​ 购买域名及实名认证不再赘述,可通过阿里云.腾讯云等平台自行购买域名. 域名解析 进入解析界面 添加记录 选择主机记录,根据提示自行选择 记录类型选 ...

  2. THUSC2019去不了记

    因为泥萌都去SC了,就我在学校里考水考模拟,所以这就变成了水考模拟游记了 Day1 早上本来要到教室早读,发现教室被由年级前\(100\)的非竞赛生的dalao给占据了,发现聪聪在里面,于是进去愉快的 ...

  3. 【Luogu5348】密码解锁(莫比乌斯反演,数论)

    [Luogu5348]密码解锁(莫比乌斯反演,数论) 题面 洛谷 题解 首先题目给定的限制是\(\sum_{n|i}a[i]=\mu(n)\),然后把这个东西反演一下, 莫比乌斯反演的式子是:\(g( ...

  4. golang --strings 下常用函数api

    1. func Compare(a, b string) int {} 比较返回一个按字典顺序比较两个字符串的整数.如果a == b则结果为0,如果a <b则结果为-1,如果a> b则结果 ...

  5. 用友U9执行JS代码。

      UFSoft.UBF.UI.AtlasHelper.RegisterAtlasStartupScript(part.Page, part.Page.GetType(), "JavaScr ...

  6. Common Lisp中的读取宏 ' #' `( , ,@) #( ) #na( ) #<OBJECT> :Keyword

    当你把  xx 当做符号使用时   'xx  ,  这个符号是没有任何函数/变量语义的, 仅仅是一个 符号而已(就像一个string一样) 但你可以对这个string有其他的用法,比如使用它所bind ...

  7. ES6入门系列 ----- 对象的遍历

    工作中遍历对象是家常便饭了,遍历数组的方法五花八门, 然而很多小伙伴是不是和我之前一样只会用for ...in.... 来遍历对象呢, 今天给大家介绍五种遍历对象属性的方法: 1, 最常用的for  ...

  8. 2.redis 和 memcached 有什么区别?redis 的线程模型是什么?为什么 redis 单线程却能支撑高并发?

    作者:中华石杉 面试题 redis 和 memcached 有什么区别?redis 的线程模型是什么?为什么 redis 单线程却能支撑高并发? 面试官心理分析 这个是问 redis 的时候,最基本的 ...

  9. win10自带截屏操作

    1.win+shift+S,自由截屏 2.win+W,截屏后编辑 3.alt+PrtSc,截取当前活动界面,鼠标在微信就是微信,在浏览器就是浏览器.在桌面就是所有界面. 4.PrtScn,截取所有屏幕 ...

  10. DF1协议常用命令

    PCCC:Programmable Controller Communication Commands. AB PLC常用指令 根据http://www.iatips.com/pccc_tips.ht ...