centos7安装运行Elasticsearch7.1

centos7安装运行Elasticsearch7.1,centos7 安装es7,centos安装elk
[root@guangzhou src]# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-linux-x86_64.tar.gz

[root@guangzhou src]# mv elasticsearch-7.1.1 elasticsearch && mv elasticsearch /usr/local/elasticsearch

[root@guangzhou src]# cd /usr/local/elasticsearch



#编辑配置信息

[root@guangzhou elasticsearch]# vim config/elasticsearch.yml

#单机模式,取消注释

node.name: node-1

#数据存储路径

path.data: /usr/local/elasticsearch/data

#日志存放路径

path.logs: /usr/local/elasticsearch/logs

#指定主节点

cluster.initial_master_nodes: ["127.0.0.1:9300"]

#发现模块

discovery.seed_hosts: ["127.0.0.1", "[::1]"]

#取消IP限制

network.host: 0.0.0.0

#访问端口

http.port: 9200



#更改jvm相关配置

[elk@guangzhou elasticsearch]$ vim config/jvm.options

-Xms512m

Xmx512m


启动es:

[root@guangzhou bin]# ./elasticsearch
[2020-02-07T16:08:40,816][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [node-1] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.1.1.jar:7.1.1]
    at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.1.1.jar:7.1.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
    at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:102) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:169) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:325) ~[elasticsearch-7.1.1.jar:7.1.1]
    at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.1.1.jar:7.1.1]
    ... 6 more

#错误显示的不能以root运行elasticsearh,考虑到后面会搭建elk,新建用户名elk来运行elasticsearch
[root@guangzhou bin]# groupadd elk
[root@guangzhou bin]# useradd -g elk elk
[root@guangzhou bin]# chown -R elk:elk /usr/local/elasticsearch/

#再次运行
[root@guangzhou bin]# su elk
[elk@guangzhou bin]$ ./elasticsearch
...

#新开窗口输入以下命令看结果知道启动成功
[root@guangzhou bin]# curl http://127.0.0.1:9200
{
  "name" : "node-1",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "7.1.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7a013de",
    "build_date" : "2019-05-23T14:04:00.380842Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
  • 发表于 2020-06-12 11:38
  • 阅读 ( 266 )
  • 分类:linux

0 条评论

请先 登录 后评论
不写代码的码农
威猛的小站长

117 篇文章

作家榜 »

  1. 威猛的小站长 117 文章
  2. Jonny 65 文章
  3. 江南烟雨 33 文章
  4. - Nightmare 33 文章
  5. doublechina 31 文章
  6. HJ社区-肖峰 29 文章
  7. 伪摄影 20 文章
  8. Alan 14 文章