【linux/elasticsearch】在虚拟机上安装elasticsearch8.0.0再次记录


7.1.1版本:

前篇:

说明:因为前篇是在7.1.1基础上写成的,感觉有些设置已经过时,故我又创建一个账户ufo试了次,果然如此!现将过程记录如下:

【目标】

把ES单例在虚拟机中的centos7里跑起来,让环回地址:9200和ip:9200都可访问。

【创建用户】

[root@localhost ~]# ls
anaconda-ks.cfg                          initial-setup-ks.cfg
elasticsearch-8.0.0-linux-x86_64.tar.gz  jdk-8u321-linux-x64.tar.gz
[root@localhost ~]# useradd ufo
[root@localhost ~]# passwd ufo
Changing password for user ufo.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost ~]# ls
anaconda-ks.cfg                          initial-setup-ks.cfg
elasticsearch-8.0.0-linux-x86_64.tar.gz  jdk-8u321-linux-x64.tar.gz
[root@localhost ~]# cp elasticsearch-8.0.0-linux-x86_64.tar.gz /home/ufo
[root@localhost ~]# su - ufo
[ufo@localhost ~]$

【解压执行】

tar -xvzf elasticsearch-8.0.0-linux-x86_64.tar.gz
cd elasticsearch-8.0.0/bin
./elasticsearch

【修改elasticsearch.yml】

以下红色部分为修改值,需要提醒大家的是,在启动es之前,security那些节点是不会出来的,故前面特地给它执行一次。

# ======================== 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: ufo-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: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- 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 -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
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"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false

#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically      
# generated to configure Elasticsearch security features on 19-02-2022 11:40:12
#
# --------------------------------------------------------------------------------

# Enable security features
xpack.security.enabled: false

xpack.security.enrollment.enabled: false

# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
  enabled: false
  keystore.path: certs/http.p12

# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
  enabled: false
  verification_mode: certificate
  keystore.path: certs/transport.p12
  truststore.path: certs/transport.p12
# Create a new cluster with the current node only
# Additional nodes can still join the cluster later
cluster.initial_master_nodes: ["localhost.localdomain"]

#----------------------- END SECURITY AUTO CONFIGURATION -------------------------

以上红色部分为我的修改点,除此外没有别的修改,以前在7.1.1里面的那些修改项都没有了。

修改完以后,启动起来,看到Started字样,就可以在本机和其它机器访问ES了。

确实顺手多了,实际的修改项可能比我写出的更少,这个就请大家去尝试了。

END

相关