ElasticSearch2.3.1环境搭建哪些不为人知的坑
首先说明一点,大家最好不要用什么尝鲜版,用比稳定版就好了,要不麻烦不断,另外出了问题,最好去官网,或者google搜索,因为这样靠谱些,要不现在好多都是低版本的,1.4的什么的,结果按照安装,多少情况下有这样那样的问题。
郑重声明,本文ElasticSearch2.3.1最新版的安装,其他的版本请搭建自行google,最好不要百度,百度一般都是老文章,有些版本问题很多,瞎折腾
ElasticSearch 安装配置
这个有点老套了,具体大家去移步官网:https://www.elastic.co/guide/en/sense/current/installing.html
按照上面博客的步骤,我安装了elasticsearch-2.3.1版本的,Java 1.8版本,可是不知道为何运行不起来
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:270)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
网站一搜,环境变量的问题,可是结果里里外外搞了三次就是不行,去官网搜一下,解决额 ./bin/elasticsearch -Des.insecure.allow.root=true
具体出现问题可以对号入座。这个是因为权限,分组的问题,可以给es用户组 权限等等 具体问题可以百度其他的
marvel的安装请参考官网
https://www.elastic.co/guide/en/marvel/current/installing-marvel.html
cd /usr/share/elasticsearch
sudo bin/plugin install license
sudo bin/plugin install marvel-agent
现在是:http://localhost:9200/_plugin/marvel/ 是空白,还是不知道啥原因,算了,先把数据库数据导入进来再说
推荐:Elasticsearch入门中文版 http://es.xiaoleilu.com/010_Intro/00_README.htm
https://www.gitbook.com/book/looly/elasticsearch-the-definitive-guide-cn/details
将MySQL中的数据导入ElasticSearch
上面那篇文章的问题,下面将会说明
由于es官网叫停river类的导入插件,因此原始的elasticsearch-jdbc-river变更为elasticsearch-jdbc,成为一个独立的导入工具。官方提到的同类型工具还有logstash,个人觉得logstash在做数据库同步的时候并不是很好用,有太多坑要填。
目前2.0以上版本并不支持windows的环境,所以各位同学不要试了,windows下最高支持到1.7.3。(2015.12.9)
所以大家看到
- ./bin/plugin --install river-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</span>
这样的命令 那么就是坑,因为官方不让安装了,因为这个问题,我折腾了好久
具体做法就是
- $ wget http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.1.0/elasticsearch-jdbc-2.3.1.0-dist.zip
- $ unzip elasticsearch-jdbc-2.3.1.0-dist.zip
编辑vim import.sh
下面 database是我MySQL数据库名称
table是我mysql的表名称
- "index" : "test",
index是es中的数据结构,你可以把他看成mysql中的库
- "type" : "stdutent"
type类似于mysql中的表
- bin=/root/elasticsearch-2.3.1/elasticsearch-jdbc-2.3.1.0/bin
- lib=/root/elasticsearch-2.3.1/elasticsearch-jdbc-2.3.1.0/lib
- echo '{
- "type" : "jdbc",
- "jdbc": {
- "url":"jdbc:mysql://localhost:3306/database",
- "user":"root",
- "password":"root",
- "sql":"select * from table",
- "index" : "test",
- "type" : "stdutent"
- }
- }'| java \
- -cp "${lib}/*" \
- -Dlog4j.configurationFile=${bin}/log4j2.xml \
- org.xbib.tools.Runner \
- org.xbib.tools.JDBCImporter
chmod +x import.sh 根据数据库原因,导入可能有些慢
运行之后./import.sh
往下
- [root@localhost elasticsearch-jdbc-2.3.1.0]# curl 'http://localhost:9200/test/student/_search?pretty&q=*'
如果有数据,说明导入成功
任何东西不考虑环境因素,那么坑很多,jdbc具体安装可以参考 这个可能是个完善的方法,我上面只能导入一个表的文件
详细的jdbc安装可以参考下面一篇文章
http://bluereader.org/article/122422454
ElasticSearch2.3.1环境搭建哪些不为人知的坑的更多相关文章
- kubernetes实战之consul简单测试环境搭建及填坑
这一节内容有点长,我们将介绍如何基于docker搭建一client一server的consul测试环境,以及如何搭建多server consul测试集群.在基于docker搭建多server的cons ...
- angular环境搭建时的坑
安装angular环境踩过一些坑,最终还是把工程跑起来了,这里描述一下我的步骤,不排除有些步骤是多余的,希望能对遇到同样问题的小伙伴有帮助. 下载最新版node.js. 安装node,安装过程一路点下 ...
- 搜索引擎ElasticSearch系列(一): ElasticSearch2.4.4环境搭建
一:ElasticSearch简介 Elasticsearch is a distributed, RESTful search and analytics engine capable of sol ...
- elasticsearch6.5集群环境搭建的一些坑
都说el配置很简单,确实比solr简单多了,不用手动配置一大堆,不过第一次配置也不轻松,因为马虎老是漏掉了许多地方 配置一个半小时才启动成功: 这里主要记录一下一些遇到的坑: 一 不能用root启动, ...
- facebook atc弱网环境搭建和踩坑总结
facebook atc介绍 Augmented Traffic Control(又名atc)是一种模拟网络状况的工具.由facebook开源,是一个允许开发人员控制设备与互联网连接的项目.atc可以 ...
- Titanium开发环境搭建第二个坑
1. build时总提示 --key-password <keypass> 参数没传,不填又说密码不对,填对了又说没传,应该是ide的问题,暂时不知怎样去设置该命令参数: 2. 继续去T ...
- Titanium开发环境搭建第一个坑
操作系统: Ubuntu 12.04 LTS AMD64 在Titanium Studio中,装Titanium CLI怎么都不能成功,到了一个进度,发现卡在那里,硬盘一直狂闪,发现在Studio的文 ...
- 一、laya学习笔记 --- layabox环境搭建 HelloWorld(坑:ts版本问题解决方案)
好吧,使用layabox需要从官网下载些啥呢 一.下载layabox 官网 https://www.layabox.com/ 首页上有两个,一个Engine,一个IDE Engine我下载的TS版本, ...
- PHP 环境搭建及zabbix安装遇到的一些坑.
参考https://segmentfault.com/a/1190000003409708 进行php环境搭建. 下载 php5 http://windows.php.net/download 下载 ...
随机推荐
- Configuring a remote m-phy
An interface for low power, high bandwidth communications between units in a device in provided here ...
- Objective-C的基础数据结构
类的数据结构 Class(指针) ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 typedef struct objc_c ...
- HDU1078 FatMouse and Cheese 【内存搜索】
FatMouse and Cheese Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Othe ...
- 国产操作系统剽窃Linux内核可耻!
10月28日,新浪科技发表文章,题为"国产操作系统迎来利好:部委机构正大量採购",读后有感. 如今,国家进入法制时代.政府採购"国产操作系统",似乎成为一种&q ...
- 编译freetype 的dll
因需要给python使用freetype库,so需要一个freetype的dll 2 steps 1. 在VC中设置输出为动态链接库 2. 修改ftoption.h 在284行增加2行代码即可 /** ...
- Optimizing concurrent accesses in a directory-based coherency protocol
In one embodiment, the present invention includes a directory to aid in maintaining control of a cac ...
- Spring 的 ApplicationEvent and ApplicationListener
什么是ApplicationContext? 它是Spring的核心,Context我们通常解释为上下文环境,可是理解成容器会更好些. ApplicationContext则是应用的容器. Sprin ...
- OpenGL(二十) glutSpecialFunc响应键盘方向控制键
OpenGL的glut中使用glutMouseFunc函数注册鼠标响应事件,使用glutKeyboardFunc函数注册键盘响应事件,对键盘上特殊的4个方向按键的响应函数是glutSpecialFun ...
- Ubuntu+NDK编译openssl(为了Android上使用libcurl且支持HTTPS协议)
为了Android上使用libcurl且支持HTTPS协议,需要依赖openssl,因此先来了解一下如何编译OpenSSL1.编译ARM下的共享库(默认的)我使用的是guardianproject的o ...
- jquery trim()的用法
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...