elasticsearch-7.13.0 安装部署
- 前提准备
- 安装说明
- 安装步骤
- 安装JDK
- 解压
- 修改配置文件
- 设置用户名及密码
- 创建运行用户
- 修改限制
- 修改内核参数
- 启动
- 测试
前提准备
| 序号 | 软件 |
|---|
| 1 | jdk-8u192-linux-x64.rpm |
| 2 | elasticsearch-7.13.0-linux-x86_64.tar.gz |
安装说明
| 内容 | 描述 |
|---|
| 服务器IP | 192.168.16.128 |
| 安装位置 | /usr/local/elasticsearch/ |
| conf文件 | /usr/local/elasticsearch/config |
安装步骤
安装JDK
$ rpm -ivh jdk-8u192-linux-x64.rpm
$ vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_192-amd64
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin;
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
$ source /etc/profile
解压
$ tar -zxvf elasticsearch-7.13.0-linux-x86_64.tar.gz
$ mv elasticsearch-7.13.0 /usr/local/elasticsearch
# 创建数据存储目录
$ mkdir /usr/local/elasticsearch/data
修改配置文件
$ cd config/
$ vim elasticsearch.yml
cluster.name: sj_test
node.name: function-test-13
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
network.host: 192.168.16.128
http.port: 9200
discovery.seed_hosts: ["192.168.16.128"]
cluster.initial_master_nodes: ["function-test-13"]
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.enabled: true
xpack.license.self_generated.type: basic
xpack.security.transport.ssl.enabled: true
设置用户名及密码
$ ./elasticsearch-setup-passwords interactive
密码:123456
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]
创建运行用户
$ useradd es
$ chown -R es.es /usr/local/elasticsearch
修改限制
$ vim /etc/security/limits.conf
es hard memlock unlimited
es soft memlock unlimited
es hard nofile 65535
es soft nofile 65535
es hard nproc 65535
es soft nproc 65535
修改内核参数
$ vim /etc/sysctl.conf
vm.max_map_count = 262144
$ sysctl -p
启动
su - es -c "/usr/local/elasticsearch/bin/elasticsearch -d"
测试
# 使用用户名/密码访问
curl http://elastic:123456@192.168.16.128:9200/_cluster/health?pretty
{
"cluster_name" : "sj_test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 0,
"active_shards" : 0,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"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" : 100.0