elasticsearch安装记录

来源:互联网 发布:交换机端口限速 编辑:程序博客网 时间:2024/05/03 06:41

一、ES安装

1. 下载安装包,并解压

官网地址:
https://www.elastic.co/

下载后安装:
$ unzip elasticsearch-2.3.2.zip

2. 启动

进入bin目录
$ ./elasticsearch -d

注:./elasticsearch --help 查看其它选项
如果启动不成功, 报错“add -XX:-UseSuperWord to the JAVA_OPTS environment variable”,是jdk版本不正确,一般为版本过低,下载1.8以上版本。


启动成功记录如下:
[edianzu@edianzu bin]$ ./elasticsearch[2016-05-14 14:44:48,637][WARN ][bootstrap unable to install syscall filter: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in[2016-05-14 14:44:49,287][INFO][node] [Andrew Chord] version[2.3.2], pid[2487], build[b9e4a6a/2016-04-21T16:03:47Z][2016-05-14 14:44:49,287][INFO ][node] [Andrew Chord] initializing ...[2016-05-14 14:44:50,637][INFO ][plugins] [Andrew Chord] modules [reindex, lang-expression, lang-groovy], plugins [], sites [][2016-05-14 14:44:50,680][INFO ][env] [Andrew Chord] using [1] data paths, mounts [[/ (/dev/mapper/vg_edianzu-lv_root)]], net usable_space [12.1gb], net total_space [17.2gb], spins? [possibly], types [ext4][2016-05-14 14:44:50,681][INFO][env] [Andrew Chord] heap size [1007.3mb], compressed ordinary object pointers [true][2016-05-14 14:44:50,681][WARN ][env] [Andrew Chord] max file descriptors [4096] for elasticsearch process likely too low, consider increasing to at least [65536][2016-05-14 14:44:55,044][INFO ][node] [Andrew Chord] initialized[2016-05-14 14:44:55,044][INFO ][node] [Andrew Chord] starting ...[2016-05-14 14:44:55,199][INFO][transport] [Andrew Chord] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}[2016-05-14 14:44:55,207][INFO ][discovery] [Andrew Chord] elasticsearch/9sZc9fd_TxmtnWicHfqRUQ[2016-05-14 14:44:58,292][INFO][cluster.service] [Andrew Chord] new_master {Andrew Chord}{9sZc9fd_TxmtnWicHfqRUQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)[2016-05-14 14:44:58,336][INFO ][http] [Andrew Chord] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}[2016-05-14 14:44:58,337][INFO ][node] [Andrew Chord] started[2016-05-14 14:44:58,391][INFO ][gateway ] [Andrew Chord] recovered [0] indices into cluster_state[2016-05-14 14:47:18,127][INFO ][cluster.metadata] [Andrew Chord] [twitter] creating index, cause [auto(index api)], templates [], shards [5]/[1], mappings [user][2016-05-14 14:47:18,535][INFO ][cluster.routing.allocation] [Andrew Chord] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[twitter][4], [twitter][4]] ...]).[2016-05-14 14:47:18,568][INFO ][cluster.metadata ] [Andrew Chord] [twitter] update_mapping [user]


3. 浏览器中访问

http://192.168.XX.XX:9200
如果在局域网中无法访问,需要修改 elasticsearch.yml配置文件,
增加“network.host: 0.0.0.0”。

二.head安装

1. 安装

$ ./plugin install mobz/elasticsearch-head
注:5.0以上版本不能直接安装,需要以服务的形式安装,本文暂不介绍

2. 访问

http://192.168.14.128:9200/_plugin/head/


一般开发安装完head即可,下面可不装

三.marvel安装

1. 英文原版安装地址 

https://www.elastic.co/guide/en/marvel/current/index.html
https://www.elastic.co/guide/en/marvel/current/getting-started.html

2. 安装license 

第一次可能失败,重复安装即可,如下:
[edianzu@edianzu bin]$ ./plugin install license-> Installing license...Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/license/2.3.2/license-2.3.2.zip ...ERROR: failed to download out of all possible locations..., use --verbose to get detailed information[edianzu@edianzu bin]$ ./plugin install license-> Installing license...Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/license/2.3.2/license-2.3.2.zip ...Downloading .......DONEVerifying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/license/2.3.2/license-2.3.2.zip checksums if available ...Downloading .DONEInstalled license into /home/edianzu/elasticsearch-2.3.2/plugins/license 

3. 安装Marvel-agent

[edianzu@edianzu bin]$ ./plugin install marvel-agent-> Installing marvel-agent...Trying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/marvel-agent/2.3.2/marvel-agent-2.3.2.zip ...Downloading ..........DONEVerifying https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/marvel-agent/2.3.2/marvel-agent-2.3.2.zip checksums if available ...Downloading .DONE@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@     WARNING: plugin requires additional permissions     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@* java.lang.RuntimePermission setFactory* javax.net.ssl.SSLPermission setHostnameVerifierSee http://docs.oracle.com/javase/8/docs/technotes/guides/security/permissions.htmlfor descriptions of what these permissions allow and the associated risks.Continue with installation? [y/N]yInstalled marvel-agent into /home/edianzu/elasticsearch-2.3.2/plugins/marvel-agent

四.安装Kibana 

1. 地址 

https://www.elastic.co/downloads/kibana

2. 安装Kibana

安装文档:
https://www.elastic.co/guide/en/kibana/current/setup.html

a.解压kibana压缩包
b.进入bin目录,安装插件
同样,第一次可能失败,需重复安装:
[edianzu@edianzu bin]$ ./kibana plugin --install elasticsearch/marvel/2.3.2Installing marvelAttempting to transfer from https://download.elastic.co/elasticsearch/marvel/marvel-2.3.2.tar.gzError: Client request error: socket hang upPlugin installation was unsuccessful due to error "Client request error: socket hang up"[edianzu@edianzu bin]$ ./kibana plugin --install elasticsearch/marvel/2.3.2Installing marvelAttempting to transfer from https://download.elastic.co/elasticsearch/marvel/marvel-2.3.2.tar.gzTransferring 1576917 bytes....................Transfer completeExtracting plugin archiveExtraction completeOptimizing and caching browser bundles...Plugin installation complete

c. 后台启动kibana
[edianzu@edianzu bin]$ nohup /home/edianzu/kibana-4.5.0/bin/kibana &

d. 浏览器访问

3. 安装Marvel到kibana

# ./kibana  plugin --install elasticsearch/marvel/latest 

4. 浏览kibana

http://192.168.14.128:5601/
并切换到Marvel


5. marvel请求地址

http://localhost:5601/app/marvel

6. kibana监控页面



三、IK安装

1.地址

https://github.com/medcl/elasticsearch-analysis-ik

2.安装maven,并配置环境变量

3.进入到IK解压后的根目录 

$ mvn clean package 

4.将文件拷入到es插件目录下

$ mkdir /home/user/elasticsearch-xx/plugins/ik 
$ cp target/releases/elasticsearch-analysis-ik-{version}.zip /home/user/elsticsearch-xx/plugins/ik 
$ cd ../ik 
$ unzip elasticsearch-analysis-ik-{version}.zip 
重启es

四、常用命令

1.保存文档

curl -XPUT 'localhost:9200/megacorp/employee/3?pretty' -d'{     "first_name" :  "Douglas",    "last_name" :   "Fir",    "age" :         35,    "about":        "I like to build cabinets",    "interests":  [ "forestry" ]}'

2.查询文档

curl -XGEY 'localhost:9200/megacorp/employee/1'

3.高亮显示

curl -XGEY 'localhost:9200/megacorp/employee/_search?pretty' -d '{    "query" : {        "match_phrase" : {            "about" : "rock climbing"        }    },    "highlight": {        "fields" : {            "about" : {}        }    }}'

4. 集群健康

http://192.168.14.128:9200/_cluster/health?pretty

5.查看所有插件

$ bin/logstash-plugin list

6.删除所有数据

curl -XDELETE 'http://localhost:9200/_all' 
0 0
原创粉丝点击