- 安裝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執(zhí)行./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: "*"