https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.0.zip
unzip elasticsearch-5.2.0.zipchown -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
参考文档:https://github.com/elastic/rally
【原创】原创文章,更多关注敬请关注微信公众号。