elasticsearch安装

java

Elasticsearch 要求至少是Java 7。更推荐使用 Oracle JDK version 1.8.0_25。

java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

下载 elasticsearch1.7.2

 wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz
 or
 curl -L -O https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.tar.gz

解压

tar -xzvf elasticsearch-1.7.2.tar.gz 

安装Marvel

Marvel是elasticsearch 一个管理和监控工具,
Elasticsearch Marvel是一个管理和监视工具,免费供开发使用。它带有一个交互式控制台称为意义上,这使得它很容易跟Elasticsearch直接从您的浏览器。

Marvel 可作为插件使用。在elasticsearch目录执行如下命令即可下载和安装marvel:

./bin/plugin -i elasticsearch/marvel/latest

你可能不想要marvel 去监控你的本地集群,因此你可以执行如下命令:

 echo 'marvel.agent.enabled: false' >> ./config/elasticsearch.yml

启动

  1. 默认启动(不指定集群名和节点名)
bin/elasticsearch
[2015-09-28 16:29:24,500][INFO ][node                     ] [Thog] version[1.7.2], pid[8688], build[e43676b/2015-09-14T09:49:53Z]
[2015-09-28 16:29:24,501][INFO ][node                     ] [Thog] initializing ...
[2015-09-28 16:29:24,631][INFO ][plugins                  ] [Thog] loaded [marvel], sites [marvel]
[2015-09-28 16:29:24,722][INFO ][env                      ] [Thog] using [1] data paths, mounts [[/ (/dev/sda1)]], net usable_space [348.5gb], net total_space [450.5gb], types [ext4]
[2015-09-28 16:29:27,722][INFO ][node                     ] [Thog] initialized
[2015-09-28 16:29:27,722][INFO ][node                     ] [Thog] starting ...
[2015-09-28 16:29:27,779][INFO ][transport                ] [Thog] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/10.32.24.78:9300]}
[2015-09-28 16:29:27,813][INFO ][discovery                ] [Thog] elasticsearch/fnn8XFTJTJeDEX3az4ylbQ
[2015-09-28 16:29:31,587][INFO ][cluster.service          ] [Thog] new_master [Thog][fnn8XFTJTJeDEX3az4ylbQ][wangyue-um][inet[/10.32.24.78:9300]], reason: zen-disco-join (elected_as_master)
[2015-09-28 16:29:31,616][INFO ][http                     ] [Thog] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/10.32.24.78:9200]}
[2015-09-28 16:29:31,616][INFO ][node                     ] [Thog] started
[2015-09-28 16:29:31,685][INFO ][gateway                  ] [Thog] recovered [0] indices into cluster_state
[2015-09-28 16:29:38,607][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] creating index, cause [auto(bulk api)], templates [marvel], shards [1]/[1], mappings [indices_stats, cluster_stats, node_stats, shard_event, node_event, index_event, index_stats, _default_, cluster_state, cluster_event, routing_event]
[2015-09-28 16:29:39,307][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [node_stats] (dynamic)
[2015-09-28 16:29:39,363][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [node_event] (dynamic)
[2015-09-28 16:29:39,371][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [index_event] (dynamic)
[2015-09-28 16:29:39,384][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [routing_event] (dynamic)
[2015-09-28 16:29:39,394][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [cluster_event] (dynamic)
[2015-09-28 16:29:39,401][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [cluster_state] (dynamic)
[2015-09-28 16:29:39,481][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [indices_stats] (dynamic)
[2015-09-28 16:29:39,563][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [index_stats] (dynamic)
[2015-09-28 16:29:39,581][INFO ][cluster.metadata         ] [Thog] [.marvel-2015.09.28] update_mapping [cluster_stats] (dynamic)
  1. 指定集群名和节点名
bin/elasticsearch --cluster .name cluster-1 --node .name node-1 &

默认,elasticsearch 使用9200端口 提供REST API 访问服务。这个端口是可配置的

验证

  1. 浏览器 打开web ui:localhost:9200

    {
      "status" : 200,
      "name" : "White Tiger",
      "cluster_name" : "elasticsearch",
      "version" : {
        "number" : "1.7.2",
        "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
        "build_timestamp" : "2015-09-14T09:49:53Z",
        "build_snapshot" : false,
        "lucene_version" : "4.10.4"
      },
      "tagline" : "You Know, for Search"
    }
  2. curl

    curl 'http://localhost:9200/?pretty'
    {
      "status" : 200,
      "name" : "White Tiger",
      "cluster_name" : "elasticsearch",
      "version" : {
        "number" : "1.7.2",
        "build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
        "build_timestamp" : "2015-09-14T09:49:53Z",
        "build_snapshot" : false,
        "lucene_version" : "4.10.4"
      },
      "tagline" : "You Know, for Search"
    }
  3. health

    curl 'localhost:9200/_cat/health?v'
    epoch      timestamp cluster       status node.total node.data shards pri relo init unassign pending_tasks 
    1443429741 16:42:21  elasticsearch yellow          1         1      1   1    0    0        1             0

每当我们问集群健康,我们要么得到绿色,黄色和红色。绿色意味着一切是好的(集群功能齐全),黄色意味着所有数据是可用的,但是一些副本尚未分配(集群功能齐全),和红色意味着一些数据不可用无论什么原因。注意,即使一个集群是红色的,它仍然是部分功能(即它将继续搜索请求从服务可用的碎片)但是你可能需要尽快修复它,因为你有缺失的数据。

  1. nodes
curl 'localhost:9200/_cat/nodes?v'
host       ip        heap.percent ram.percent load node.role master name        
wangyue-um 127.0.0.1           13          71 0.39 d         *      White Tiger 
  1. list all indices

    curl 'localhost:9200/_cat/indices?v'
    health status index              pri rep docs.count docs.deleted store.size pri.store.size 
    yellow open   .marvel-2015.09.28   1   1        390            0      2.7mb          2.7mb 
  2. get shards

    curl 'localhost:9200/_cat/shards?v'
    index              shard prirep state      docs store ip        node        
    .marvel-2015.09.28 0     p      STARTED     426 2.8mb 127.0.0.1 White Tiger 
    .marvel-2015.09.28 0     r      UNASSIGNED                                  
  3. shutdown

     curl -XPOST 'http://localhost:9200/_shutdown'
    [2015-09-28 16:53:41,417][INFO ][action.admin.cluster.node.shutdown] [White Tiger] [cluster_shutdown]: requested, shutting down in [1s]
    {"cluster_name":"elasticsearch","nodes":{"tF-kYPx2TTGUHvdgIuCxog":{"name":"White Tiger"}}}wangyue@wangyue-um:/home/cluster/apps/elasticsearch/elasticsearch-1.7.2$ [2015-09-28 16:53:42,419][INFO ][action.admin.cluster.node.shutdown] [White Tiger] [cluster_shutdown]: done shutting down all nodes except master, proceeding to master
    [2015-09-28 16:53:42,422][INFO ][action.admin.cluster.node.shutdown] [White Tiger] shutting down in [200ms]
    [2015-09-28 16:53:42,624][INFO ][action.admin.cluster.node.shutdown] [White Tiger] initiating requested shutdown...
    [2015-09-28 16:53:42,624][INFO ][node                     ] [White Tiger] stopping ...
    [2015-09-28 16:53:43,200][INFO ][node                     ] [White Tiger] stopped
    [2015-09-28 16:53:43,200][INFO ][node                     ] [White Tiger] closing ...
    [2015-09-28 16:53:43,204][INFO ][node                     ] [White Tiger] closed
  4. 浏览 Marvel and Sense
    http://localhost:9200/_plugin/marvel/
    这里写图片描述
    cluster:
    这里写图片描述
    index:
    这里写图片描述
    nodes:
    这里写图片描述
    http://localhost:9200/_plugin/marvel/sense/
    这里写图片描述

尊重原创,拒绝转载
http://blog.csdn.net/stark_summer/article/details/48786865

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以从官方网站下载Elasticsearch安装包。官网下载地址为。 2. 下载完成后,解压缩安装包。你可以使用以下命令解压缩tar.gz文件: ```shell tar -zxvf elasticsearch-7.8.1-linux-x86_64.tar.gz ``` 3. 解压缩完成后,进入解压缩后的目录,找到配置文件elasticsearch.yml。你可以使用以下命令来编辑该文件并进行配置: ```shell vim /usr/local/elasticsearch-7.13.2/config/elasticsearch.yml ``` 4. 在编辑配置文件之前,你可能需要了解一些配置选项以满足你的需求。根据你的环境和需求,修改elasticsearch.yml文件中的配置选项。 5. 当你完成了配置文件的修改后,保存并退出编辑器。 6. 现在,可以启动Elasticsearch了。你可以使用以下命令启动Elasticsearch: ```shell ./bin/elasticsearch ``` 这是一个基本的安装和启动Elasticsearch的过程。请注意,具体的步骤可能因操作系统和版本而略有不同。确保你仔细阅读官方文档以获取更详细的安装指南。 关于卸载Elasticsearch,你可以按照以下步骤进行操作: 1. 首先,你可以通过以下命令来查看已安装Elasticsearch软件包: ```shell dpkg -l | grep elastic ``` 2. 接下来,你可以使用以下命令查找Elasticsearch安装关联: ```shell dpkg -L elasticsearch ``` 3. 然后,使用以下命令来移除已安装Elasticsearch软件包: ```shell dpkg -P elasticsearch ``` 4. 继续使用以下命令查找未卸载的目录和文件: ```shell find ./elasticsearch | grep elasticsearch ``` 注意:根据你的环境和安装方式,可能会有其他目录和文件与Elasticsearch相关。 5. 最后,根据你的环境,使用以下命令来移除相关的目录和文件: ```shell rm -r /var/lib/elasticsearch rm /var/lib/dpkg/info/elasticsearch.* rm /etc/default/elasticsearch rm /etc/init.d/elasticsearch ``` 请根据自己的具体环境和需求来执行移除目录和文件的操作,确保操作正确无误。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [一、ElasticSearch安装](https://blog.csdn.net/m0_51295655/article/details/123193074)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值