Skip to content
This repository has been archived by the owner on Jun 14, 2022. It is now read-only.

Kibana 不能正常运行 #23

Closed
954-Ivory opened this issue Jul 28, 2018 · 18 comments
Closed

Kibana 不能正常运行 #23

954-Ivory opened this issue Jul 28, 2018 · 18 comments
Labels
question Further information is requested

Comments

@954-Ivory
Copy link

提示错误:
plugin:elasticsearch@6.2.4 | Unable to connect to Elasticsearch at http://elastic:9200.

@kezhenxu94
Copy link
Owner

@BadGrem 你是使用docker-compose一次性启动的es和kibana的,还是在自己机器运行es?

@954-Ivory
Copy link
Author

我用的是docker-compose
ubuntu 18.04
docker-compose version 1.17.1, build unknown
docker-py version: 2.5.1
CPython version: 2.7.15rc1
OpenSSL version: OpenSSL 1.1.0g 2 Nov 2017

@kezhenxu94
Copy link
Owner

kezhenxu94 commented Jul 29, 2018

@BadGrem 你可以尝试将

    kibana:
        image: docker.elastic.co/kibana/kibana-oss:6.2.4
        container_name: kibana
        networks:
            - localhost
        ports:
            - 5601:5601
        environment:
            - ELASTICSEARCH_URL=http://elastic:9200
        depends_on:
            - elastic

其中的 http://elastic:9200 换成 http://127.0.0.1:9200

@954-Ivory
Copy link
Author

954-Ivory commented Jul 30, 2018

Unable to connect to Elasticsearch at http://127.0.0.1:9200.

@kezhenxu94
Copy link
Owner

@BadGrem 使用docker logs elastic 看看es是否启动成功

@954-Ivory
Copy link
Author

954-Ivory commented Jul 30, 2018

$ docker logs elastic
Error: No such container: elastic
$ docker logs elasticsearch
OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
[2018-07-30T17:59:31,254][INFO ][o.e.n.Node               ] [] initializing ...
[2018-07-30T17:59:31,350][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:125) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.2.4.jar:6.2.4]        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:85) ~[elasticsearch-6.2.4.jar:6.2.4]
Caused by: java.lang.IllegalStateException: Failed to create node environment
        at org.elasticsearch.node.Node.<init>(Node.java:267) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]
        ... 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_161]
        at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781) ~[?:1.8.0_161]
        at java.nio.file.Files.createDirectories(Files.java:767) ~[?:1.8.0_161]
        at org.elasticsearch.env.NodeEnvironment.<init>(NodeEnvironment.java:204) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.node.Node.<init>(Node.java:264) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.node.Node.<init>(Node.java:246) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:213) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:323) ~[elasticsearch-6.2.4.jar:6.2.4]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:121) ~[elasticsearch-6.2.4.jar:6.2.4]
        ... 6 more

我又尝试了在Windows下利用docker-toolbox尝试配置,仍然是报一样的错误:
Unable to connect to Elasticsearch at http://elastic:9200.

@954-Ivory
Copy link
Author

954-Ivory commented Jul 30, 2018

$ docker-compose up --build -d
Creating network "houserentingmaster_localhost" with the default driver
Building crawler
Step 1/6 : FROM python:3
 ---> 638817465c7d
Step 2/6 : MAINTAINER kezhenxu94 <kezhenxu94@163.com>
 ---> Using cache
 ---> 6db9c8ea5370
Step 3/6 : COPY . /house-renting/crawler
 ---> Using cache
 ---> d2f157adee46
Step 4/6 : VOLUME /etc/scrapyd/ /var/lib/scrapyd/
 ---> Using cache
 ---> 4b9f106328a9
Step 5/6 : WORKDIR /house-renting/crawler
 ---> Using cache
 ---> 22d293e7c8d8
Step 6/6 : RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
 ---> Using cache
 ---> 3d551172bac2
Successfully built 3d551172bac2
Successfully tagged house-renting/crawler:latest
Building scrapyd
Step 1/6 : FROM python:3
 ---> 638817465c7d
Step 2/6 : MAINTAINER kezhenxu94 <kezhenxu94@163.com>
 ---> Using cache
 ---> 6db9c8ea5370
Step 3/6 : VOLUME /etc/scrapyd/ /var/lib/scrapyd/
 ---> Using cache
 ---> 06d040cbf51e
Step 4/6 : COPY ./scrapyd.conf /etc/scrapyd/
 ---> Using cache
 ---> c41ae1de321b
Step 5/6 : RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple scrapyd
 ---> Using cache
 ---> e982fa7f2eb5
Step 6/6 : ENTRYPOINT ["scrapyd"]
 ---> Using cache
 ---> 81132e097275
Successfully built 81132e097275
Successfully tagged house-renting/scrapyd:latest
Creating redis         ... done
Creating elasticsearch ... done
Creating crawler       ... done
Creating kibana        ... done
Creating scrapyd       ... done
Creating 58            ... done
Creating douban        ... done
Creating lianjia       ... done

看起来好像没啥问题...

qq 20180731030221

@954-Ivory
Copy link
Author

954-Ivory commented Jul 30, 2018

我尝试将image换成下面这两个

image: elasticsearch
image: kibana

在 index pattern 中出现了问题 Unable to fetch mapping. Do you have indices matching the pattern?

所以我又将docker-compose.yml换成84374c5版本,但是58同城的信息貌似没有被爬取到。

@kezhenxu94
Copy link
Owner

@BadGrem Unable to fetch mapping. Do you have indices matching the pattern?
是因为没有爬到数据入 es,如果没有爬到,可能是反爬机制升级,我再看看,你有空也可以帮忙看看:handshake:

@hao-lee
Copy link

hao-lee commented Sep 6, 2018

你这是权限问题啊老哥,你把源码目录下的 data/elastic/ 改成权限 777 就好了。我也遇到了这个问题,参考这个问题下的评论才解决。

@smelike
Copy link

smelike commented Oct 11, 2018

你这是权限问题啊老哥,你把源码目录下的 data/elastic/ 改成权限 777 就好了。我也遇到了这个问题,参考这个问题下的评论才解决。

改了 777,也不行

@hao-lee
Copy link

hao-lee commented Oct 11, 2018

@smelike 重新 build 呢

@Torah
Copy link

Torah commented Jan 18, 2019

@smelike 重新 build 呢

也是不行。作者应该给一下微信号,那个微信和支付宝大赏转了帐,但是号码显示不全,联系不到作者。这个系统的价值在于elasticsearch,年初我看到过类似的项目,本来想改一下,但是因为是java,不是特别擅长。现在这个作为字段查找不错,但是这个elastic问题不解决就没法正常挂起es,这是这个系统的核心。

@Torah
Copy link

Torah commented Jan 19, 2019

经过人因工程学和作者联系上了。这个问题很可能可以通过如下方式解决(我这里是这样解决的,也可以查看log去查找问题的解决办法https://www.cnblogs.com/yehui/p/9087845.html):
sudo nano /etc/sysctl.conf //修改参数
在最后添加vm.max_map_count=262144
sudo reboot
cat /proc/sys/vm/max_map_count再看一眼
重新build

@kezhenxu94 kezhenxu94 added the question Further information is requested label Feb 1, 2019
@MangoMinLi
Copy link

把源码目录下的 data/elastic/ 改成权限 777,重新build,在重新启动,可以解决这个问题。谢谢@hao-lee

@kezhenxu94 kezhenxu94 pinned this issue Mar 12, 2019
@hao-lee
Copy link

hao-lee commented Mar 12, 2019

@MangoMinLi 😏
作者已经把这个 issue 置顶了 😄

@jiangchao1987
Copy link

可以用single-node模式,参考elastic/elasticsearch#45815

elastic:
  environment:
    - discovery.type=single-node

@Paulswith
Copy link

经过人因工程学和作者联系上了。这个问题很可能可以通过如下方式解决(我这里是这样解决的,也可以查看log去查找问题的解决办法https://www.cnblogs.com/yehui/p/9087845.html):%EF%BC%9A)
sudo nano /etc/sysctl.conf //修改参数
在最后添加vm.max_map_count=262144
sudo reboot
cat /proc/sys/vm/max_map_count再看一眼
重新build

这个sudo sysctl -p 就可以生效, 记得还原ELASTICSEARCH_URL=http://elastic:9200, 谢谢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

8 participants