ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

elasticsearch工作笔记002---Centos7.3安装最新版elasticsearch-7.0.0-beta1-x86_64.rpm单机版安装

2019-03-03 18:48:43  阅读:3069  来源: 互联网

标签:node rw 单机版 root cluster elasticsearch 安装 localhost


技术交流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/试一试就可以了

 

 

 

 

 

标签:node,rw,单机版,root,cluster,elasticsearch,安装,localhost
来源: https://blog.csdn.net/lidew521/article/details/88091539

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有