Docker image access to local elasticsearch port operation

Docker image access to local elasticsearch port operation

Using the image service deployed by docker stack, after entering the image, in theory, you should be able to access the local elasticsearch service through the following instructions

curl local ip/9200

But it says access denied.

Later, after using the above instructions to check, it was found that the machine also denied access.

Later, it was discovered that the elasticsearch service on port 9200 was connected to the elasticsearch service on the remote server by punching a hole, and the port could only be accessed through the following command:

curl 127.0.0.1:9200

If you want to access port 9200 through the local IP address, you need to add -g after the hole-punching command.

Additional knowledge: When running elasticsearch in docker, port 9200 cannot be accessed, and the container is closed as soon as it is started

When using docker to install es, access to port 9200 failed. Using docker ps to view the container, it was found that after starting es, it would automatically shut down after a period of time. I increased the virtual machine's memory to 4G, and the problem persisted.

In fact, the main problem is that the memory allocated to ES is too small:

1. Enter the etc directory and edit the sysctl.conf file:

vi /etc/sysctl.conf

2. Add configuration:

vm.max_map_count=262144

3. Execution:

sysctl -p

4. If starting es still fails, modify limits.conf:

vi /etc/security/limits.conf
*soft nofile 65536
*hard nofile 131072
* soft nproc 2048
* hard nproc 4096

5. Finally, restart the virtual machine and access the browser: http://192.168.162.131:9200. You can see that the startup is successful:

I succeeded by only modifying sysctl.conf, without modifying limits.conf

The above docker image access to the local elasticsearch port operation is all the content shared by the editor. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Docker container accesses the host's MySQL operation
  • Docker container custom hosts network access operation
  • Docker port mapping and external inaccessibility issues
  • How to enable remote access in Docker
  • Solution to the problem that Docker container cannot access Jupyter
  • 404 error occurs when accessing the homepage of tomcat started in Docker mode
  • Solution to docker suddenly not being accessible from the external network

<<:  Beginners learn some HTML tags (3)

>>:  In-depth understanding of Mysql logical architecture

Recommend

How to use custom tags in html

Custom tags can be used freely in XML files and HT...

IE8 Beta 1 has two areas that require your attention

<br />Related articles: Web skills: Multiple...

Detailed explanation of this pointing problem in JavaScript

Preface The this pointer in JS has always been a ...

Use of Linux telnet command

1. Introduction The telnet command is used to log...

Detailed explanation of the mysql database LIKE operator in python

The LIKE operator is used in the WHERE clause to ...

mysql5.5.28 installation tutorial is super detailed!

mysql5.5.28 installation tutorial for your refere...

MySQL Full-text Indexing Guide

Full-text indexing requires special query syntax....

Detailed explanation of MySQL sql99 syntax inner join and non-equivalent join

#Case: Query employee salary levels SELECT salary...

Web designers should optimize web pages from three aspects

<br />With the increase of bandwidth, there ...

HTML+css to create a simple progress bar

1. HTML code Copy code The code is as follows: Ex...

Solution to running out of MySQL's auto-increment ID (primary key)

There are many types of auto-increment IDs used i...

Detailed analysis of compiling and installing vsFTP 3.0.3

Vulnerability Details VSFTP is a set of FTP serve...

Set IE8 to use IE7 style code

<meta http-equiv="x-ua-compatible" co...