Install Elasticsearch on Windows and combine it with intranet penetration to achieve remote access

Recently, I discovered a super powerful artificial intelligence learning website. It presents complex concepts in an easy-to-understand way and is entertaining. I thought it might be helpful to everyone, so I'm sharing it here. Click here to jump to the website.


Elasticsearch is a distributed search and analysis engine based on the Lucene library. It provides a distributed, multi-tenant full-text search engine with an HTTP web interface and schemaless JSON documents. It is also a very powerful tool that can be used for Various uses such as log analysis, search engines, security analysis, and more.

The advantage of remote connection is that it allows users to access the Elasticsearch cluster from a remote location, which allows convenient data query and management. The specific benefits are as follows:

  1. Convenient remote collaboration: Remote connections allow multiple users to access the Elasticsearch cluster from different places at the same time, facilitating team collaboration and data sharing.
  2. Improve data security: Remote connections allow users to query and manage data locally, avoiding the risk of directly operating data on the server and improving data security.
  3. Convenient data backup: Remote connection allows users to easily back up data locally, avoiding the risk of data loss.
  4. Improve data processing efficiency: Remote connection allows users to perform data processing and analysis locally, avoiding time and bandwidth limitations of data transmission, and improving data processing efficiency.

The following describes how to install Elasticsearch on Windows and combine it with Cpolar to achieve remote connection and access!

System environment

JDK 1.8

1. Install Elasticsearch on Windows

Enter the official download interface: https://www.elastic.co/downloads/elasticsearch, select the windows version to download, Elasticsearch requires a java environment to run, if there is no installation environment, you need to install JDK in advance.

image-20231110145417985

After downloading, unzip it, enter the bin directory, findelasticsearch.bat and execute the one-click startup of the script file.

image-20231110145816972

After startup, pay special attention to a user name and a password information in the cmd window. This user name and password are required for access and login.

image-20231110151352328

2. Access Elasticsearch locally

After running the service, enter https://lcoalhost:9200 in the browser, and you will be prompted to enter the username and password. Fill in the username we saw above: elastic and the corresponding password, and the access will be successful. Below Install the Cpolar tool to achieve remote access

image-20231110152246542

3. Windows installation Cpolar

Visit the cpolar official website, register an account, and then download and install the client. For specific installation instructions, please refer to the official website documentation tutorial.

Cpolar官网:https://www.cpolar.com/download

  • Windows system: After downloading the installation package from the official website, double-click the installation package and install it by default.
  • Linux system: supports one-click automatic installation script. For details, please refer to the official website documentation——Getting Started Guide

image-20231113140709326

Note! After Cpolar is successfully installed, the default Cpolar web interface access port is also 9200, which may conflict with Elasticsearch. You need to modify the Cpolar management interface port. If the Elasticsearch port is not 9200, you do not need to modify it.

Find the cpolar configuration file:c:\Users\用户名\.cpolar\cpolar.yml, use Notepad++ editing tool or other software to open it

image-20231113140858314

In the configuration file, add a line:client_dashboard_addr: 127.0.0.1:9800, the port can be customized, here use 9800

image-20231113141453289

After modification, remember to save the configuration file, and then restart the cpolar service in Control Panel – Management Tools – Services – cpolar service

image-20231113141414399

Then enter in the browserlocalhost:9800 to access the Cpolar Web UI management interface. Enter the account registered on the official website to log in.

image-20231113141644952

4. Create an Elasticsearch public network access address

After logging in, click Tunnel Management - Create Tunnel on the left dashboard to create a 9200 http tunnel.

  • Tunnel name: The name can be customized. Be careful not to duplicate the existing tunnel name.
  • Protocol: Select http
  • Local address: https://127.0.0.1:9200 (fill in the complete address for https local access)
  • Domain name type: Choose a random domain name for free
  • Region: Select China

Click创建

image-20231113150106574

After the tunnel is successfully created, click the status on the left - Online Tunnel List to view the generated public network access address. There are two access methods, one is http and https. Since the local one is https, we only need to use the https address. Can

image-20231113150229680

5. Remote access to Elasticsearch

Open the browser and use the Cpolar https public network address to access it. You can see that the access is successful. In this way, a public network address for remote or any device browser access is set.

image-20231113150402441

summary

For a better demonstration, we used the tunnel generated by cpolar in the aforementioned process, and its public network address was randomly generated.

The advantage of this random address is that it is established quickly and can be used immediately. However, its disadvantage is that the URL is generated by random characters and is not easy to remember (for example: 3ad5da5.r10.cpolar.top). In addition, this address will change randomly within 24 hours, making it more suitable for temporary use.

I usually use a fixed second-level subdomain name because I hope that when I send the URL to colleagues or clients, it will be a fixed and easy-to-remember public address (for example: crm.cpolar.cn), which makes it more formal and convenient. Communicate and collaborate.

6. Set up a fixed second-level subdomain name

Since the tunnel created using cpolar above uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access. Therefore, we can configure a second-level subdomain name for it. This address is a fixed address and will not change randomly [ps: cpolar.cn has been filed]

Note that you need to upgrade the cpolar package to a basic package or above, and the bandwidth corresponding to each package is different. [cpolar.cn has been registered]

Log in to the cpolar official website backend, click Reserve on the left, select to reserve the second-level subdomain name, set a second-level subdomain name, click Reserve, and copy the reserved one after the reservation is successful. Second-level subdomain name

image-20231113151721641

After the reservation is successful, copy the reserved second-level subdomain name address

image-20231113151751358

Log in to the cpolar web UI management interface, click Tunnel Management - Tunnel List on the left dashboard, find the tunnel you want to configure, and click Edit on the right

image-20231113152109057

Modify the tunnel information and configure the successfully reserved second-level subdomain name into the tunnel.

  • Domain name type: Select a second-level subdomain name
  • Sub Domain: Fill in the successfully reserved second-level subdomain name

Click更新

image-20231113152142969

After the update is completed, open the online tunnel list. At this time, you can see that the public network address has changed and the address name has become a reserved and fixed second-level subdomain name.

image-20231113152233962

Finally, use the fixed domain name public network https address to access, you can see that the access is also successful, so a permanent fixed public network address is set!

image-20231113152348531

Guess you like

Origin blog.csdn.net/xz2935117143/article/details/134441239