elasticsearch工作笔记002---Centos7.3安装最新版elasticsearch-7.0.0-beta1-x86_64.rpm单机版安装
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了elasticsearch工作笔记002---Centos7.3安装最新版elasticsearch-7.0.0-beta1-x86_64.rpm单机版安装,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含9077字,纯文字阅读大概需要13分钟。
内容图文
技术交流QQ群【JAVA,.NET,BigData,AI】:170933152
这东西用来做大数据检索,可以跟hadoop一起使用。
安装准备:
1.安装jdk
2.给虚拟机配置静态ip,可以查看其它博文怎么配置
3.开始安装:在centos7上操作
我把elasticsearch,放在了/usr/elasticsearch下面,到这个目录然后:
https://www.elastic.co/downloads/elasticsearch#preview-release 先去这里地址,找到rpm包,然后复制地址
执行:wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.0-beta1-x86_64.rpm
开始下载,挺大的得下一会儿
4.直接解压安装,超级方便,一步到位
rpm -ivh elasticsearch-2.3.5.rpm systemctl daemon-reloa//这个我没有执行成功,但是也没发现有什么影响
5.启动并查看安装状态,直接下载完解压,就可以启动起来
systemctl start elasticsearch systemctl status elasticsearch
6.启动的日志
[root@localhost elasticsearch]# systemctl status elasticsearch
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
Active: active (running) since Mon 2019-03-04 01:32:11 CST; 19s ago
Docs: http://www.elastic.co
Main PID: 12458 (java)
CGroup: /system.slice/elasticsearch.service
├─12458 /lib/jvm/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -Des.networkaddress.cache.tt...
└─12517 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
7.然后去访问一下看看:
curl -XGET "127.0.0.1:9200" 或者运行 curl http://localhost:9200 curl http://127.0.0.1:9200 都可以
8.可以看到没问题
{
"name" : "node-1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "1QcPN8ZvQWKmeP-nP7UvkQ",
"version" : {
"number" : "7.0.0-beta1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "15bb494",
"build_date" : "2019-02-13T12:30:14.432234Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
9.但是这个时候从外面的浏览器访问,访问不了,这个时候这样配置,进入到下面的目录,然后编辑
elasticsearch.yml文件
node.name: node-1 前面的#打开
#network.host: 192.168.0.1
network.host: 192.168.136.110
#network.host: 0.0.0.0
#network.host: localhost
#network.host: 127.0.0.1 这里把network.host 设置为自己的ip地址 网上有设置成0.0.0.0的应该也可以自己设置一下试试
cluster.initial_master_nodes: ["node-1"] 这里一定要这样设置,我就是这里没有这样设置出问题的,弄了好久
在最后加上这两句,要不然,外面浏览器就访问不了哈
http.cors.enabled: true
http.cors.allow-origin: "*"
[root@localhost elasticsearch]# cd /etc/elasticsearch/
[root@localhost elasticsearch]# ll
total 48
-rw-r--r-- 1 root elasticsearch 5123 Mar 4 00:20 df
-rw-rw---- 1 root elasticsearch 207 Mar 3 21:28 elasticsearch.keystore
-rw-rw---- 1 root elasticsearch 3101 Mar 4 01:32 elasticsearch.yml
-rw-rw---- 1 root elasticsearch 3685 Feb 13 20:37 jvm.options
-rw-rw---- 1 root elasticsearch 17170 Feb 13 20:37 log4j2.properties
-rw-rw---- 1 root elasticsearch 473 Feb 13 20:37 role_mapping.yml
-rw-rw---- 1 root elasticsearch 197 Feb 13 20:37 roles.yml
-rw-rw---- 1 root elasticsearch 0 Feb 13 20:37 users
-rw-rw---- 1 root elasticsearch 0 Feb 13 20:37 users_roles
[root@localhost elasticsearch]# vi elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /var/lib/elasticsearch
#
# Path to log files:
#
path.logs: /var/log/elasticsearch
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
"elasticsearch.yml" 98L, 3101C
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
network.host: 192.168.136.110
#network.host: 0.0.0.0
#network.host: localhost
#network.host: 127.0.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#discovery.seed_hosts:["my-application"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
http.cors.enabled: true
http.cors.allow-origin: "*"
出了一些错误,具体是下面这几个
就是因上面的配置之前不对造成的,按照上面的配置完,再启动,就没有问题了
记录一下问题:
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
一直都报这个错误,如果不配:
#cluster.initial_master_nodes: ["node-1", "node-2"]
cluster.initial_master_nodes: ["node-1"] 这个的话,这里的node-1是上面一个默认的记得打开就可以了
[2019-03-04T00:52:55,299][DEBUG][o.e.a.ActionModule ] [localhost.localdomain] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-03-04T00:52:55,869][INFO ][o.e.d.DiscoveryModule ] [localhost.localdomain] using discovery type [zen] and seed hosts providers [settings]
[2019-03-04T00:52:58,023][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
[2019-03-04T00:52:58,023][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
[2019-03-04T00:52:58,317][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {192.168.136.110:9300}, bound_addresses {[::]:9300}
[2019-03-04T00:52:58,336][INFO ][o.e.b.BootstrapChecks ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2019-03-04T00:52:58,427][ERROR][o.e.b.Bootstrap ] [localhost.localdomain] node validation exception
[1] bootstrap checks failed
[1]: 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
网上还有说ES启动不能用Root用户的,我跟着也新建了一个用户,但是最终发现,不用这个新建的 用户也行,所以应该是不用新建用户,直接用root用户就可以的
成功后可以试试:
[root@localhost elasticsearch]# curl http://192.168.136.110:9200
{
"name" : "node-1",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "1QcPN8ZvQWKmeP-nP7UvkQ",
"version" : {
"number" : "7.0.0-beta1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "15bb494",
"build_date" : "2019-02-13T12:30:14.432234Z",
"build_snapshot" : false,
"lucene_version" : "8.0.0",
"minimum_wire_compatibility_version" : "6.7.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
然后在浏览器上同样:http://192.168.136.110:9200/试一试就可以了
内容总结
以上是互联网集市为您收集整理的elasticsearch工作笔记002---Centos7.3安装最新版elasticsearch-7.0.0-beta1-x86_64.rpm单机版安装全部内容,希望文章能够帮你解决elasticsearch工作笔记002---Centos7.3安装最新版elasticsearch-7.0.0-beta1-x86_64.rpm单机版安装所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。