Linux下Elasticsearch 1.7.0安装配置(3)

[root@localhost target]# cd /data/elasticsearch-1.7.0
[root@localhost elasticsearch-1.7.0]# ls
bin  config  data  lib  LICENSE.txt  logs  NOTICE.txt  plugins  README.textile
[root@localhost elasticsearch-1.7.0]# cd plugins/
[root@localhost plugins]# ls
bigdesk  head  ik  marvel
[root@localhost plugins]# cd ik/
[root@localhost ik]# ls
elasticsearch-analysis-ik-1.2.6.jar

注意:如果是集群,可以将jar分别copy至其他几台机器。

es配置文件需要添加入下行:

index:
  analysis:                   
    analyzer:     
      ik:
          alias: [ik_analyzer]
          type: org.elasticsearch.index.analysis.IkAnalyzerProvider
      ik_max_word:
          type: ik
          use_smart: false
      ik_smart:
          type: ik
          use_smart: true
marvel.agent.enabled: false

完整的es配置文件如下,三台同样的配置,除了hostip和node.name外.

# cat elasticsearch.yml
cluster.name: test-es-cluster
network.host: 172.16.2.24
node.name: "node24"
discovery.zen.ping.unicast.hosts: ["172.16.2.24:25555","172.16.2.21:25555","172.16.2.23:25555"]
index.number_of_shards: 5
discovery.zen.minimum_master_nodes: 2
script.groovy.sandbox.enabled: false
transport.tcp.port: 25555
http.port: 25556
script.inline: off
script.indexed: off
script.file: off
index:
  analysis:                   
    analyzer:     
      ik:
          alias: [ik_analyzer]
          type: org.elasticsearch.index.analysis.IkAnalyzerProvider
      ik_max_word:
          type: ik
          use_smart: false
      ik_smart:
          type: ik
          use_smart: true
marvel.agent.enabled: false

后台启动es服务:

[root@localhost bin]# pwd
/data/elasticsearch-1.7.0/bin
[root@localhost bin]# ./elasticsearch -d

三台集群的机器中找其中一台创建索引:

创建索引:

curl -X PUT 'http://172.16.2.24:25556/index'
{"acknowledged":true}

注意:返回结果为acknowledged":true 为成功.

通过浏览器访问::25556/_plugin/head/ 测试效果.

Elasticsearch 教程系列文章: 

Linux上安装部署ElasticSearch全程记录 

Elasticsearch安装使用教程

ElasticSearch 配置文件译文解析

ElasticSearch的工作机制   

Elasticsearch的安装,运行和基本配置

使用Elasticsearch + Logstash + Kibana搭建日志集中分析平台实践 

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/e7de254784ff3911d4344f144949ce33.html