willie108
By:
willie108

Multiple instances-containers of elasticsearch on docker

May 24, 2016 878 views
Docker Elasticsearch Ubuntu

trying to run multiple copies of elastic search using the following commands.

docker run -d -p 9200:9200 -p 5601:5601 nshou/elasticsearch-kibana

docker run -d -p 9202:9200 -p 5602:5601 nshou/elasticsearch-kibana

after running these I can access at ports 9200 and 9202 (and 5601 and 5602).

But I seem to get errors when I run the python script below. Also, I want to run the script below separately for each of the docker instances (containers?), I want to run slightly different versions of the python script actually. What do I need to do to set this up?

4 comments
  • Your methodology should work, based on what you've written here.

    Would it be possible to provide the errors you are receiving, as well as the script (or documentation for it, etc. -- it seems to have gotten cut off from your original post)? I was unable to replicate the issue with this image off-hand, so to better assist you, the community may benefit from a little more detail, if at all possible.

    There's also another maintained ELK Docker image with extensive documentation here:

    https://elk-docker.readthedocs.io/

    Which may also help you getting this up and running, if there was something under-documented elsewhere for your selected image.

  • Another issue is that sometimes when I run the script I get this
    /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
    /usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl
    .py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
    Segmentation fault

  • when I rebooted the machine and the segmentation fault disappeared.

  • when I try to post the code here it does not upload I don't know why. Anyway, how can I run one script for one of the installations and a different for the other. Right now I am running one script. Then I did this
    root@dgone:~# docker run -d -p 9204:9200 -p 5604:5601 nshou/elasticsearch-kibana
    4c3cc4cdba39c53a96aa7dbfd1ed033a5ea76aa1d0f90c326cead5a606bff074
    root@dgone:~# docker ps -a
    CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
    4c3cc4cdba39 nshou/elasticsearch-kibana "/bin/sh -c 'elastics" 16 seconds ago Up 15 seconds 0.0.0.0:5604->5601/tcp, 0.0.0.0:9204->9200/tcp trustinggolick
    6b510d76d8a8 nshou/elasticsearch-kibana "/bin/sh -c 'elastics" 9 hours ago Up 4 minutes 0.0.0.0:5601->5601/tcp, 0.0.0.0:9200->9200/tcp kickass
    volhard

    but how can I run a similar but slightly different script for the new container (?) I just created.
    Since I cannot upload the script let me call the first one t1.py and the second t2.py. I am running t1.py and it is indexing in the first elasticsearch. Now I want to run t2.py and have it index to the second elasticsearch.

    Also, now I am getting this error.
    Traceback (most recent call last):
    File "Tpym.py", line 71, in <module>
    stream.filter(locations=GEOBOXWORLD)
    File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 445, in filter
    self.
    start(async)
    File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 361, in start
    self.
    run()
    File "/usr/local/lib/python2.7/dist-packages/tweepy/streaming.py", line 294, in _run
    raise exception
    elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', error(104, 'Connection reset by peer'))) caused by: ProtocolError(('Connection aborted.', error(104, 'Connection reset by peer')))

1 Answer

when I try to post the code on this forum the submit button here does not work

Have another answer? Share your knowledge.