[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 教程系列文章: