- 安装es5.3.2
参考https://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html
启动后 ,修改配置需要重启,重启需要ps -aux|grep elastic找到pid,再kill杀掉 - 安装es2.3.4
elasticsearch-jdbc当前最高只支持es2.3.4
安装参考https://www.elastic.co/guide/en/elasticsearch/reference/2.3/_installation.html
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-2.3.4.tar.gz
解压后
chown -R elasticsearch: elasticsearch elasticsearch-2.3.4/
su elasticsearch
./elasticsearch -d 后台启动
启动后,测试
curl -XGET 'localhost:9200'
如果要重启,ps -aux|grep elastic,找到进程kill掉再重启 - 安装node
安装elasticsearch-head需要安装nodejs
参考https://wenku.baidu.com/view/1c61ece6162ded630b1c59eef8c75fbfc77d94e5.html?from=search
wget https://nodejs.org/dist/v6.10.3/node-v6.10.3-linux-x64.tar.xz
yum -y install xz
xz -d node-v6.10.2-linux-x64.tar.xz
tar -xvf node-v6.10.2-linux-x64.tar
mv到/usr/local/node下面
vi /etc/profile
NODE_HOME=/usr/local/node
PATH=$PATH:$NODE_HOME/bin
export JAVA_HOME JRE_HOME CATALINA_HOME NODE_HOME PATH CLASSPATH
npm -g install grunt-cli
安装elasticsearch-head
参考https://wenku.baidu.com/view/1c61ece6162ded630b1c59eef8c75fbfc77d94e5.html?from=search
vi Gruntfile.js
npm install
grunt server
浏览器访问ip:9100案例一 入门
参考https://www.oschina.net/translate/elasticsearch-getting-started
添加索引
curl -XPUT 'localhost:9200/dept/employee/32' -d '{"empName":"Cuiym"}'案例二 导入mysql到elasticsearch
参考http://blog.csdn.net/ggz631047367/article/details/50414032
wget http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.4.0/elasticsearch-jdbc-2.3.4.0-dist.zip
安装配置后,要切换到root执行./import.shAPI
- delete
curl -XDELETE 'http://localhost:9200/twitter/tweet/1'
curl -XDELETE 'http://localhost:9200/ymm'
- 安装或启动过程报错与处理
- Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
vim config/jvm.options
-Xms2g
-Xmx2g
改为
-Xms512m
-Xmx512m
- org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
groupadd elasticsearch
useradd elasticsearch -g elasticsearch -p elasticsearch
chown -R elasticsearch: elasticsearch elasticsearch5.3.2/
- max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
http://www.cnblogs.com/woxpp/p/6061073.html - 9200缺省限制为本机访问,安装成功后在本机curl -XGET 'localhost:9200'是可以的,但在其他机器通过ip访问不行,这里需要修改elasticsearch.yml文件,增加network.bind_host: 0.0.0.0,并重启es
- elasticsearch=head无法连接9200,处理方法参考http://www.cnblogs.com/zklidd/p/6433123.html
vi elasticsearch.yml 添加
http.cors.enabled: true
http.cors.allow-origin: "*"