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

Write a shopping mall card coupon using CSS in three steps

Today is 618, and all major shopping malls are ho...

Solution to the problem that order by is not effective in MySQL subquery

By chance, I discovered that a SQL statement prod...

How to install SVN server under Linux

1. Yum installation yum install subversion 2. Con...

In-depth explanation of the principle of MySQL Innodb index

introduction Looking back four years ago, when I ...

A brief discussion on the VUE uni-app life cycle

Table of contents 1. Application Lifecycle 2. Pag...

Viewing and analyzing MySQL execution status

When you feel that there is a problem with MySQL ...

Steps to export the fields and related attributes of MySQL tables

Need to export the fields and properties of the t...

Solution to the problem of invalid line-height setting in CSS

About the invalid line-height setting in CSS Let&...

Using js to achieve the effect of carousel

Today, let's talk about how to use js to achi...

Docker container time zone adjustment operation

How to check if the Docker container time zone is...

MYSQL uses Union to merge the data of two tables and display them

Using the UNION Operator union : Used to connect ...