Elasticsearch7.x installation and deployment

table of Contents

elasticsearch7.10

download link:

installation

Configuration

System Configuration

elasticsearch configuration file 

start up

Configure username and password

Visit es

kibana7.10

download

 Configuration start



elasticsearch7.10

download link:

https://www.elastic.co/cn/downloads/

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz
mkdir /data
tar -zxf elasticsearch-7.10.0-linux-x86_64.tar.gz -C /data
cd /data
mv elasticsearch-7.10.0-linux-x86_64  elasticsearch

installation

Create a user, otherwise es cannot be started by root

Configuration

System Configuration

useradd elk -g admin -n -m
passwd xxx

chown -R elk. /data/elasticsearch

su - elk
vim /etc/security/limits.conf  # 添加
* soft nofile 65536
* hard nofile 65536
* soft nproc 32000
* hard nproc 32000
* hard memlock unlimited
* soft memlock unlimited
vim /etc/systemd/system.conf

DefaultLimitNOFILE=65536
DefaultLimitNPROC=32000
DefaultLimitMEMLOCK=infinity

/bin/systemctl daemon-reload
vim /etc/sysctl.conf
vm.max_map_count=262144
sysctl -p

elasticsearch configuration file 

Configure /data/elasticsearch/config/jvm.options

cd /data/elasticsearch/config/
vim jvm.option
-Xms4g # 根据自己的物理主机情况设置默认为系统一半的内存,不要超过32G
-Xmx4g
[elk@node3 config]$ cat elasticsearch.yml | grep -v ^# | grep -v ^$
cluster.name: test-application
node.name: node-1
node.attr.rack: r1
node.master: true
node.data: true
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 10.10.2.xxx
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.minimum_master_nodes: 1
discovery.seed_hosts: ["10.10.2.208:9300"]
discovery.zen.fd.ping_timeout: 30s
discovery.zen.fd.ping_retries: 3
cluster.initial_master_nodes: ["node-1"]

start up

# 用户不能为root 否则会报错 当前为 elk 用户
cd /data/elasticsearch
./bin/elasticsearch -d # 不加 -d 为前台启动

Configure username and password

vim config/elasticsearch.yml

http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

# 重启es

 change Password

cd bin/
./elasticsearch-setup-passwords interactive
future versions of Elasticsearch will require Java 11; your Java version from [/usr/local/jdk1.8/jre] does not meet this requirement
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y


Enter password for [elastic]: 
Reenter password for [elastic]: 
Enter password for [apm_system]: 
Reenter password for [apm_system]: 
Enter password for [kibana_system]: 
Reenter password for [kibana_system]: 
Enter password for [logstash_system]: 
Reenter password for [logstash_system]: 
Enter password for [beats_system]: 
Reenter password for [beats_system]: 
Enter password for [remote_monitoring_user]: 
Reenter password for [remote_monitoring_user]: 
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

Visit es

At this time, you need to access es through your username and password

Single node

curl -u elastic:xxxxxx -X GET 'http://10.10.2.208:9200/?pretty'   
{
  "name" : "node-1",
  "cluster_name" : "test-application",
  "cluster_uuid" : "lV4WL8bgTBiPCeEksWgTkQ",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

View cluster status

curl -u elastic:xxxxxx -X GET 'http://10.10.2.208:9200/_cluster/health?pretty'     
{
  "cluster_name" : "test-application",
  "status" : "yellow",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 15,
  "active_shards" : 15,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 4,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 78.94736842105263
}

 

kibana7.10

download

wget wget https://artifacts.elastic.co/downloads/kibana/kibana-7.10.0-linux-x86_64.tar.gz
mkdir /data
tar -zxf kibana-7.10.0-linux-x86_64.tar.gz -C /data
cd /data
mv kibana-7.10.0-linux-x86_64.tar.gz  kibana

 Configuration start

cd /data/kibana
cat config/kibana.yml  | grep -v ^# | grep -v ^$
server.port: 5601
server.host: "10.10.2.208"
elasticsearch.hosts: ["http://10.10.2.208:9200"]
elasticsearch.username: "elastic"
elasticsearch.password: "xxxxxxx"
i18n.locale: "zh-CN" # 设置中文


# 启动
# 前台启动
./bin/kibana --allow-root 
# 后台启动
nohup ./bin/kibana --allow-root >> nohup.log 2>&1 & 

 

Guess you like

Origin blog.csdn.net/ganices/article/details/110293805