ElasticSearch

ElasticSearch

docker下载的ElasticSearch镜像 web/postman访问时需要密码,如何去除

数据库李魔佛 发表了文章 • 0 个评论 • 134 次浏览 • 2018-11-13 11:40 • 来自相关话题

从docker官方镜像源下载的镜像,可以正常运行。 
可是在postman中请求接口:
GET : 10.18.6.102:9200/_cat/indices?v
 
爆出下面的错误:
missing authentication token for REST request
然后使用浏览器查询:发现需要输入账户和密码。
账户名:elastic
密码:changeme
 
如何才能删除这个用户名和密码呢? 每次请求不需要密码。
进入docker容器
修改这个文件 
/usr/share/elasticsearch/config/elasticssearch.yml

 
添加最后一行:

xpack.security.enabled: false

然后记得commit一下你的修改。
 
 
  查看全部
从docker官方镜像源下载的镜像,可以正常运行。 
可是在postman中请求接口:
GET : 10.18.6.102:9200/_cat/indices?v
 
爆出下面的错误:
missing authentication token for REST request 

然后使用浏览器查询:发现需要输入账户和密码。
账户名:elastic
密码:changeme
 
如何才能删除这个用户名和密码呢? 每次请求不需要密码。
进入docker容器
修改这个文件 
/usr/share/elasticsearch/config/elasticssearch.yml

 
添加最后一行:

xpack.security.enabled: false

然后记得commit一下你的修改。
 
 
 

Docker ElasticSearch挂载本地数据 报错

数据库李魔佛 发表了文章 • 0 个评论 • 238 次浏览 • 2018-11-13 10:37 • 来自相关话题

应用场景中需要把数据挂载在本地的目录,以便以后数据的迁移与备份。
挂载命令:docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -v /home/myuser/elastic_data/:/usr/share/elasticsearch/data docker.elastic.co/elasticsearch/elasticsearch:5.5.1
其中-v是指定的挂载路径 
/home/myuser/elastic_data/
 这个是本地路径
 
运行后报错:[2018-11-13T02:23:33,994][INFO ][o.e.n.Node ] initializing ...
[2018-11-13T02:23:34,010][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]
Caused by: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
原因是权限问题,需要把目录
/home/myuser/elastic_data/ 改为777, 然后问题就解决了chmod 777 /home/myuser/elastic_data/
原创文章
转载请注明出处:
http://30daydo.com/article/369
  查看全部
应用场景中需要把数据挂载在本地的目录,以便以后数据的迁移与备份。
挂载命令:
docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -v /home/myuser/elastic_data/:/usr/share/elasticsearch/data docker.elastic.co/elasticsearch/elasticsearch:5.5.1

其中-v是指定的挂载路径 
/home/myuser/elastic_data/
 这个是本地路径
 
运行后报错:
[2018-11-13T02:23:33,994][INFO ][o.e.n.Node               ]  initializing ...
[2018-11-13T02:23:34,010][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]
Caused by: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more

原因是权限问题,需要把目录
/home/myuser/elastic_data/ 改为777, 然后问题就解决了
chmod 777 /home/myuser/elastic_data/

原创文章
转载请注明出处:
http://30daydo.com/article/369
 

elasticsearch-head连接不上elasticsearch服务器

数据库李魔佛 发表了文章 • 0 个评论 • 130 次浏览 • 2018-11-13 09:21 • 来自相关话题

在git hub上同步下来的代码后,运行Elasticsearch-head,一直连不上去。 后来才发现这个github上的版本有问题,于是在chrome的应用商城下载了一个elasticsearch-head的插件,就可以直接用了。





  查看全部
在git hub上同步下来的代码后,运行Elasticsearch-head,一直连不上去。 后来才发现这个github上的版本有问题,于是在chrome的应用商城下载了一个elasticsearch-head的插件,就可以直接用了。

elastic.JPG

 

MongoDB数据导入到ElasticSearch python代码实现

数据库李魔佛 发表了文章 • 0 个评论 • 160 次浏览 • 2018-11-12 14:13 • 来自相关话题

ElasticSearch对文本的搜索速度真的是神速呀,基本是毫秒级别的。对于大文本,简直就是秒飞MYSQL十条街。使用python实现:es = Elasticsearch(['10.18.6.26:9200'])
ret = collection.find({})

# 删除mongo的_id字段,否则无法把Object类型插入到Elastic
map(lambda x:(del x['_id']),ret)

actions=

for idx,item in enumerate(ret):
i={
"_index":"jsl",
"_type":"text",
"_id":idx,
"_source":{
# 需要提取的字段
"title":item.get('title'),
"url":item.get('url')
}
}
actions.append(i)


start=time.time()
helpers.bulk(es,actions)

end=time.time()-start
print(end)
运行下来,20W条数据,大概用了15秒左右全部导入ElasticSearch 数据库中。 查看全部
ElasticSearch对文本的搜索速度真的是神速呀,基本是毫秒级别的。对于大文本,简直就是秒飞MYSQL十条街。使用python实现:
es = Elasticsearch(['10.18.6.26:9200'])
ret = collection.find({})

# 删除mongo的_id字段,否则无法把Object类型插入到Elastic
map(lambda x:(del x['_id']),ret)

actions=

for idx,item in enumerate(ret):
i={
"_index":"jsl",
"_type":"text",
"_id":idx,
"_source":{
# 需要提取的字段
"title":item.get('title'),
"url":item.get('url')
}
}
actions.append(i)


start=time.time()
helpers.bulk(es,actions)

end=time.time()-start
print(end)

运行下来,20W条数据,大概用了15秒左右全部导入ElasticSearch 数据库中。

docker下载的ElasticSearch镜像 web/postman访问时需要密码,如何去除

数据库李魔佛 发表了文章 • 0 个评论 • 134 次浏览 • 2018-11-13 11:40 • 来自相关话题

从docker官方镜像源下载的镜像,可以正常运行。 
可是在postman中请求接口:
GET : 10.18.6.102:9200/_cat/indices?v
 
爆出下面的错误:
missing authentication token for REST request
然后使用浏览器查询:发现需要输入账户和密码。
账户名:elastic
密码:changeme
 
如何才能删除这个用户名和密码呢? 每次请求不需要密码。
进入docker容器
修改这个文件 
/usr/share/elasticsearch/config/elasticssearch.yml

 
添加最后一行:

xpack.security.enabled: false

然后记得commit一下你的修改。
 
 
  查看全部
从docker官方镜像源下载的镜像,可以正常运行。 
可是在postman中请求接口:
GET : 10.18.6.102:9200/_cat/indices?v
 
爆出下面的错误:
missing authentication token for REST request 

然后使用浏览器查询:发现需要输入账户和密码。
账户名:elastic
密码:changeme
 
如何才能删除这个用户名和密码呢? 每次请求不需要密码。
进入docker容器
修改这个文件 
/usr/share/elasticsearch/config/elasticssearch.yml

 
添加最后一行:

xpack.security.enabled: false

然后记得commit一下你的修改。
 
 
 

Docker ElasticSearch挂载本地数据 报错

数据库李魔佛 发表了文章 • 0 个评论 • 238 次浏览 • 2018-11-13 10:37 • 来自相关话题

应用场景中需要把数据挂载在本地的目录,以便以后数据的迁移与备份。
挂载命令:docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -v /home/myuser/elastic_data/:/usr/share/elasticsearch/data docker.elastic.co/elasticsearch/elasticsearch:5.5.1
其中-v是指定的挂载路径 
/home/myuser/elastic_data/
 这个是本地路径
 
运行后报错:[2018-11-13T02:23:33,994][INFO ][o.e.n.Node ] initializing ...
[2018-11-13T02:23:34,010][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]
Caused by: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
原因是权限问题,需要把目录
/home/myuser/elastic_data/ 改为777, 然后问题就解决了chmod 777 /home/myuser/elastic_data/
原创文章
转载请注明出处:
http://30daydo.com/article/369
  查看全部
应用场景中需要把数据挂载在本地的目录,以便以后数据的迁移与备份。
挂载命令:
docker run -p 9200:9200 -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -v /home/myuser/elastic_data/:/usr/share/elasticsearch/data docker.elastic.co/elasticsearch/elasticsearch:5.5.1

其中-v是指定的挂载路径 
/home/myuser/elastic_data/
 这个是本地路径
 
运行后报错:
[2018-11-13T02:23:33,994][INFO ][o.e.n.Node               ]  initializing ...
[2018-11-13T02:23:34,010][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:127) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:114) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:67) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:122) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.cli.Command.main(Command.java:88) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:91) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.5.1.jar:5.5.1]
Caused by: java.lang.IllegalStateException: Failed to create node environment
at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more
Caused by: java.nio.file.AccessDeniedException: /usr/share/elasticsearch/data/nodes
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[?:?]
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[?:?]
at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384) ~[?:?]
at java.nio.file.Files.createDirectory(Files.java:674) ~[?:1.8.0_141]
at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_141]
at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_141]
at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:221) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.node.Node.<init>(Node.java:244) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:232) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:351) ~[elasticsearch-5.5.1.jar:5.5.1]
at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.5.1.jar:5.5.1]
... 6 more

原因是权限问题,需要把目录
/home/myuser/elastic_data/ 改为777, 然后问题就解决了
chmod 777 /home/myuser/elastic_data/

原创文章
转载请注明出处:
http://30daydo.com/article/369
 

elasticsearch-head连接不上elasticsearch服务器

数据库李魔佛 发表了文章 • 0 个评论 • 130 次浏览 • 2018-11-13 09:21 • 来自相关话题

在git hub上同步下来的代码后,运行Elasticsearch-head,一直连不上去。 后来才发现这个github上的版本有问题,于是在chrome的应用商城下载了一个elasticsearch-head的插件,就可以直接用了。





  查看全部
在git hub上同步下来的代码后,运行Elasticsearch-head,一直连不上去。 后来才发现这个github上的版本有问题,于是在chrome的应用商城下载了一个elasticsearch-head的插件,就可以直接用了。

elastic.JPG

 

MongoDB数据导入到ElasticSearch python代码实现

数据库李魔佛 发表了文章 • 0 个评论 • 160 次浏览 • 2018-11-12 14:13 • 来自相关话题

ElasticSearch对文本的搜索速度真的是神速呀,基本是毫秒级别的。对于大文本,简直就是秒飞MYSQL十条街。使用python实现:es = Elasticsearch(['10.18.6.26:9200'])
ret = collection.find({})

# 删除mongo的_id字段,否则无法把Object类型插入到Elastic
map(lambda x:(del x['_id']),ret)

actions=

for idx,item in enumerate(ret):
i={
"_index":"jsl",
"_type":"text",
"_id":idx,
"_source":{
# 需要提取的字段
"title":item.get('title'),
"url":item.get('url')
}
}
actions.append(i)


start=time.time()
helpers.bulk(es,actions)

end=time.time()-start
print(end)
运行下来,20W条数据,大概用了15秒左右全部导入ElasticSearch 数据库中。 查看全部
ElasticSearch对文本的搜索速度真的是神速呀,基本是毫秒级别的。对于大文本,简直就是秒飞MYSQL十条街。使用python实现:
es = Elasticsearch(['10.18.6.26:9200'])
ret = collection.find({})

# 删除mongo的_id字段,否则无法把Object类型插入到Elastic
map(lambda x:(del x['_id']),ret)

actions=

for idx,item in enumerate(ret):
i={
"_index":"jsl",
"_type":"text",
"_id":idx,
"_source":{
# 需要提取的字段
"title":item.get('title'),
"url":item.get('url')
}
}
actions.append(i)


start=time.time()
helpers.bulk(es,actions)

end=time.time()-start
print(end)

运行下来,20W条数据,大概用了15秒左右全部导入ElasticSearch 数据库中。