RedHat linux服务器安装elasticsearch且设置公网访问
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且设置公网访问的更多相关文章
- RedHat Linux下iptables防火墙设置
一般情况下iptables已经包含在Linux发行版中.运行 # iptables --version 来查看系统是否安装iptables 启动iptables:# service iptables ...
- 实现Redhat Linux 6和Windows通过Windows Server AD统一认证并共享访问Oracle ZS存储系统
Windows Server 2012 AD设置 1. 建立新的组织单位OU 为用户提前建立好OU,是为了AD用户管理简单清晰. 2. 建立新的用户和用户组 建立新的用户的时候,要同时将用户归属到 ...
- linux服务器安装mysql并配置外网访问
linux服务器安装mysql并配置外网访问 更新系统,如果不运行该命令,直接安装mysql,会出现"有几个软件包无法下载 sudo apt-get update 安装mysql sudo ...
- 解决CentOS6.x或RedHat Linux 6.x版本不能通过System eth0以固定IP访问外网的问题
当你在VMware Workstation Pro中,打开从别人那里克隆来的系统,或者是开启迁移后的虚拟机系统时,VMware将会提示你:此虚拟机可能已被移动或 复制.为了配置特定的管理和网络功能.V ...
- 在Linux系统中如何设置APACHE服务器里的后台页面只允许某个IP地址访问
补充资料 本网络中使用LINUX服务器,web服务器是由APACHE搭建,IP地址为192.168.1.5,后台页面为/admin/login.jsp . 如何设置后台页面LOGIN.JSP只允许19 ...
- linux 搭建ftp服务并设置限制访问目录
服务器有好几个项目,新项目前端外包,因为要微信授权登陆,所以前端没有办法本地调试,必须上次ftp在我们服务器上调试代码,当然要限制ftp访问的目录,否则整个服务器项目都能看到了. 安装vsftpd s ...
- 阿里云mysql数据库设置让公网访问客户端访问
第一步 首先使用root登入你的mysql ./mysql -u root -p 你的密码 第二步 备注:也可以添加一个用户名为yuancheng,密码为123456,权限为%(表示任意ip都能连接) ...
- NO2:设置RedHat Linux下的samba开机启动
安装的samba默认不是开机启动的,这样每次都要进入系统人为启动,很不方便,当然系统肯定可以设置开机启动的. 因为我的是RedHat Linux系统,支持chkconfig命令直接配置,会简单些,其它 ...
- Linux 安装MongoDB 并设置防火墙,使用远程客户端访问
1. 下载 MongoDB 提供了 linux 各发行版本 64 位的安装包 下载地址:https://www.mongodb.com/download-center#community 2. 安装 ...
随机推荐
- 常见的Redis面试"刁难"问题,值得一读
Redis有哪些数据结构? 字符串String.字典Hash.列表List.集合Set.有序集合SortedSet. 如果你是Redis中高级用户,还需要加上下面几种数据结构HyperLogLog.G ...
- 『You Are Given a Tree 整体分治 树形dp』
You Are Given a Tree Description A tree is an undirected graph with exactly one simple path between ...
- 【docker】centos7 上拉取docker镜像,一直拉取不到,报错:Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while w
镜像拉取一直报错: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request cancel ...
- 性能监控工具的配置及使用 - Spotlight On Oracle(oracle)
一. Spotlight On Oracle(oracle)1.1. 工具简介Spotlight是一个强有力的Oracle数据库实时性能诊断工具,提供了一个直观的.可视化的数据库活动展现.S ...
- Centos7 Putty SSH密钥登录
在本地电脑打开PuTTYgen程序,点击Generate生成密钥,可以再设置一层密码,保存公钥和私钥到本地文件,保存好,最好多处备份 先用密码登录远程Centos vim ~/.ssh/authori ...
- PIE SDK矢量栅格化算法
1.算法功能简介 矢量栅格化,由矢量数据向栅格数据的转换一般比较方便.对于点.线目标,由其所在的栅格行.列数表示,对于面状目标,则需判定落人该面积内的像元.通常栅格(像元)尺寸均大于原来坐标表示的分辨 ...
- Flask简介及使用
目录 Flask简介 wsgiref wsgiref简单应用 两个依赖 werkzeug Jinja2 简单使用 安装 flask快速使用 Django与Flask返回值的对比 Flask简介 F ...
- SQL Server强制释放内存
--强制释放内存 CREATE procedure [dbo].ClearMemory as begin --清除所有缓存 DBCC DROPCLEANBUFFERS --打开高级配置 EXEC (' ...
- xss学习
1.了解xss的定义 2.理解xss的原理:反射型和存储型 3.理解xss的攻击方式 4.掌握xss的防御措施
- HTML惊天地
博主网站 一.HTML文档结构 <!DOCTYPE html> <html lang="en"> <head> <meta charset ...