How To Install Elasticsearch on Ubuntu 14.04
最近測東西,都用整理好的docker Elasticsearch叢集
有點忘了之前Elasticsearch建置方式
補貼上去年建的Elasticsearch步驟當備忘用
1. Install Java
官方是說
[Elasticsearch recommends Oracle JDK version 1.8.0_73]
這邊可以使用OpenJDK 7或Oracle JDK 8
OpenJDK 7
sudo apt-get update
sudo apt-get install openjdk-7-jre
java -version
Oracle JDK 8
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
java -version
2. Installing Elasticsearch 1.7.2
sudo wget https://download.elastic.co/Elasticsearch/Elasticsearch/Elasticsearch-1.7.2.deb
sudo dpkg -i Elasticsearch-1.7.2.deb
3. Installing plugin
- head
sudo /usr/share/Elasticsearch/bin/plugin -install mobz/Elasticsearch-head
- marvel
sudo /usr/share/Elasticsearch/bin/plugin -install Elasticsearch/marvel/latest
- jdbc river
版本參考 http://xbib.org/repository/org/xbib/Elasticsearch/plugin/Elasticsearch-river-jdbc/
plugin --install jdbc --url http://xbib.org/repository/org/xbib/Elasticsearch/plugin/Elasticsearch-river-jdbc/1.5.0.5/Elasticsearch-river-jdbc-1.5.0.5-plugin.zip
- jdbc postgresql
版本參考列表
https://jdbc.postgresql.org/download.html
https://github.com/jprante/Elasticsearch-jdbc
wget https://jdbc.postgresql.org/download/postgresql-9.4-1204.jdbc4.jar
wget https://jdbc.postgresql.org/download/postgresql-9.4-1204.jdbc42.jar
/usr/share/Elasticsearch/plugins/jdbc
4. Configuring Elasticsearch
一些Elasticsearch檔案路徑
- /usr/share/Elasticsearch
- /etc/Elasticsearch
- /etc/init.d/Elasticsearch
sudo update-rc.d Elasticsearch defaults
設定Elasticsearch.yml檔
sudo nano /etc/Elasticsearch/Elasticsearch.yml
參考內容:
marvel.agent.enabled: false
cluster.name: bowwow
node.name: pro-bowwow
node.master: true
node.data: true
index.number_of_shards: 5
bootstrap.mlockall: true
index.cache.field.max_size: 50000
index.cache.field.expire: 10m
index.cache.field.type: soft
threadpool.index.type: fixed
threadpool.index.size: 100
threadpool.index.queue_size: 500
#discovery.zen.ping.multicast.enabled: false
#discovery.zen.ping.unicast.hosts: ["pro-bowwow","node1","node2"]
th:
data: /data/data
logs: /data/log
plugins: /data/plugins
work: /data/work
http.cors.allow-origin: "/.*/"
http.cors.enabled: true
5. 設定完成
啟用服務嘍
sudo service Elasticsearch start
測試一下
curl localhost:9200
從db建一些測試資料進去
測一下7萬筆資料內搜尋的效能
ab -n 1000 -c 10 "http://demo/songs/data/_search?&q=id:100"
嗯~~測了一下,從數千筆資料搜尋和從7萬多筆資料搜尋,Requests per second數差不多
收工嘍~收工嘍~