【001】elasticsearch7.x入门实践-简单部署

1.环境准备  Linux 7.9

注意:我本机安装的有jdk,并配置相关环境,如果没有相关环境需要参考 

https://blog.csdn.net/pang_ping/article/details/80570011  先配置环境

 

1.1切换到根目录

cd /

1.2创建 server目录

mkdir server       

cd  /server

1.3 下载 elasticsearch

wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-linux-x86_64.tar.gz

1.4解压

tar -zxfvf  elasticsearch-7.12.1

1.5  由于elastic不能在root用户上使用 需要 创建用户和用户组

# groupadd -g 1008 elastic

# useradd -g 1008 -u 1008 elastic

# chown -R elastic:elastic  elasticsearch-7.12.1

调整默认配置

修改sysctl.conf文件


# vim /etc/sysctl.conf
vm.max_map_count = 262144
 
# sysctl -p  
  修改/etc/security/limits.conf文件,修改打开文件句柄

*    soft    nofile          100000
*    hard    nofile          100000
*    soft    nproc           100000
*    hard    nproc           100000

1.6 切换用户

su elastic 

1.7 调整配置文件

cd  /server/elasticsearch-7.12.1/config  

vi  elasticsearch.yml

其中单机版本需要调整如下

cluster.name: elk-application

node.name: node-1

http.port: 9200

network.host: 0.0.0.0

 

1.8 启动

cd /server/elasticsearch-7.12.1/bin

./elasticsearch &

1.9 验收是否启动成功

浏览器里面输入 服务的地址

 

预知后续操作,且看下回分解

 

补充二:

如果elasticsearch需要启用密码需要在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: elk-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: ["node-1"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: truei
xpack.security.transport.ssl.enabled: true
xpack.security.enabled: true
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization

 

然后启动elasticsearch

最后切换到 elasticsearch对应的bin目录下面

执行如下命令 这个是自动生成相关的账户和密码的

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值