elasticsearch 5.2 部署及Rally壓力測試

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.0.zip

unzip elasticsearch-5.2.0.zip
chown -R es.es elasticsearch-5.2.0

es啓動需要在非root下,新建賬號和創建數據目錄
useradd es
mkdir /export/es52/

修改配置文件
cat elasticsearch.yml
path.data: /export/es52/data
path.logs: /export/es52/logs
network.host: 192.168.80.11

啓動
./bin/elasticsearch -d
jps 驗證

curl http://192.168.80.11:9200/
{
  "name" : "g-H2EPn",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "UbMTV1G5QtGyBjCRZ9XJSw",
  "version" : {
    "number" : "5.2.0",
    "build_hash" : "24e05b9",
    "build_date" : "2017-01-24T19:52:35.800Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.0"
  },
  "tagline" : "You Know, for Search"
}

配合kibana安裝x-pack監控插件
./elasticsearch-plugin  install x-pack
添加配置項
#x-pack
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
重啓es

安裝kibana
https://artifacts.elastic.co/downloads/kibana/kibana-5.2.0-linux-x86_64.tar.gz
tar zxvf kibana-5.2.0-linux-x86_64.tar.gz
./kibana-plugin install x-pack

修改配置
cat kibana.yml
server.host: "192.168.80.11"
elasticsearch.url: "http://192.168.80.11:9200"

啓動
nohup ./kibana &

http://192.168.80.11:5601
默認賬號: elastic 和 changeme

其實我們能用到的功能也就Dev tools和Monitoring

壓測ES---Rally安裝使用
github上提供了rally作爲elasticsearch的性能測試工具,較好的解決了es性能測試問題。
依賴環境:
python3.4+
pip3
JDK8
git1.9+
Gradle2.13+(可選如果需要從源代碼編譯則需要)

python3 與 pip3 安裝與使用
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

tar zxvf Python-3.5.2.tgz
cd Python-3.5.2
./configure --prefix=/usr/local/python3
make && make install
mv /usr/bin/python  /usr/bin/python_old
ln -s /usr/local/python3/bin/python3.5  /usr/bin/python
python --version

ln -s /usr/python3.5/bin/pip3.5  /usr/bin/pip
安裝完成默認就有pip3了

yum install gcc perl-ExtUtils-MakeMaker curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum remove git
tar xzf git-2.11.0.tar.gz
cd git-2.11.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
git --version

jdk安裝解壓即可
java -version
java version "1.8.0_112"

安裝gradle
Gradle 是一款構建工具,繼 Ant 、Maven 之後的現代構建工具。
http://services.gradle.org/distributions/gradle-2.13-all.zip
mkdir /opt/gradle
unzip -d /opt/gradle gradle-2.13-all.zip
cat /etc/profile
export PATH=$PATH:/opt/gradle/gradle-2.13/bin
source /etc/profile
gradle -v

安裝esrally (其實絕對路徑即可)
pip3 install esrally

由於elasticsearch的運行必須非root賬戶。esrally建議用非root賬戶執行。“race”表示Rally一次壓測過程。你可以使用不同的數據集(稱之爲tracks)來進行壓測。
非root用戶(es用戶)初始化
./esrally configure
Enter the JDK 8 root directory:: /export/servers/jdk1.8.0_112
下載數據集

./esrally list tracks



這時可以查看配置文件
/root/.rally/rally.ini

[reporting]
datastore.type = in-memory
datastore.host = 192.168.80.11
datastore.port = 9200
datastore.secure = False
datastore.user =
datastore.password =

提前準備數據:
在.rally/benchmarks下(沒有的目錄自己創建即可)
data  distributions  races  tracks
把源碼包下載下來distributions/elasticsearch-5.2.0.tar.gz

.rally/benchmarks/data/geonames
documents.json.bz2放入該目錄下。
http://benchmarks.elasticsearch.org.s3.amazonaws.com/corpora/geonames/documents.json.bz2(下載過程漫長)

./esrally --distribution-version=5.2.0


./esrally --target-hosts=192.168.80.11:9200 --challenge=append-fast-no-conflicts --pipeline=benchmark-only

參考文檔:https://github.com/elastic/rally


【原創】原創文章,更多關注敬請關注微信公衆號。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章