Location>code7788 >text

Mastering Docker: Best Practices for Simplifying KES Standalone Installation and Management

Popularity:26 ℃/2024-10-01 11:57:06

Today we're going to continue our deep dive into a standalone installation of KES, still centered around the use of Docker. This section will cover some common pitfalls as well as how to give effective feedback and resolve issues when encountered. First, we need to find the official installation tutorial, making sure to follow the official guide as the main guide, while incorporating our own usage habits.

Why do we favor Docker so much over traditional command line installations? In today's cloud computing era, Docker has become an almost essential skill that greatly simplifies the process of environment configuration and application deployment, making development and operations more efficient.

Next, we will explain in detail the specific installation steps and precautions to help you successfully complete the installation of KES. Let's get started!

stand-alone installation

Here I would like to share the official installation steps with you, you can access the detailed installation guide by following the link below:Official Installation Steps. Meanwhile, if you need to download related software or resources, please go to the official download address:Official download page

These links provide comprehensive documentation and tools to help make your installation and configuration go more smoothly. We recommend that you read the official guide carefully before installing to better understand the specifics and considerations of each step.

image

I have prepared the relevant download links for you and you can get the required files at the following address:download address

A special note of caution is that although this link contains Chinese characters, which does not materially affect the download process, such a link format is not ideal from the standpoint of standardization and readability. Therefore, it is recommended that officials try to avoid using Chinese characters in the naming of future links in order to improve the clarity and consistency of the links.

image

We will continue to use the Pagoda panel for direct installation, as I chose the Docker version so that we can import the image directly for use. Note that the official images available to the public are not yet available to the public, so this way is the most convenient option at the moment.

Importing Images

Initially, I intended to do the import directly through the Import Mirror feature of the Pagoda panel, but unfortunately, this method failed to work. Therefore, I had to turn to the command line to do the import. The specific commands are as follows:docker load -i

image

At this point, after the command line operation, the local environment will be successfully generated in the required image, to facilitate the subsequent use and deployment.

image

We decided to start the service directly using the Compose template instead of using the officially provided command line form. This approach not only simplifies the configuration process, but also increases our flexibility and efficiency in managing our multi-container application.

version: "2"
services.
  kingbase.
    image: kingbase_v009r001c001b0030_single_x86:v1
    container_name: kingbase
    privileged: true # Note that the indentation here is aligned with the previous key-value pairs.
    environment.
      - ENABLE_CI=yes # yes (default case insensitive)/no case sensitive
      - NEED_START=yes # yes (default start database)/ no (do not start database)
      - DB_USER=system # default user name
      - DB_PASSWORD=12345678ab # default password
      - DB_MODE=oracle # support oracle/pg/mysql
    volumes.
      - /mnt/kingbase/data:/home/kingbase/userdata
    ports: /mnt/kingbase/data:/home/kingbase/userdata
      - 4321:54321
    restart: unless-stopped
    command: /usr/sbin/init

The process of creating the orchestration model has been completed successfully and all relevant configurations and settings have been applied successfully.

image

Next, we will launch the appropriate templates in order to quickly set up the required environment and services.

image

Starting services

Next, we just need to boot the system, and the related log information is very clear and concise, which helps us in troubleshooting and performance monitoring. However, I encountered some problems here and the boot process did not complete successfully.

image

Of particular note, since I had already installed Kingbase once before, but forgot to empty the previously mounted persistence directory during this installation, this resulted in a boot failure. For novice users, the system usually boots up and runs successfully when doing the initial installation.

During a successful installation, the related log messages clearly show the steps and status, and the following is the log output when the installation is successful:

image

After a successful startup, we can go directly inside the container to make a password-free connection to test the database's proper operation. First, we need to make sure that the database service has started successfully:

sys_ctl -D /home/kingbase/userdata/data/ status

Next, we will perform a password-free login operation to ensure seamless access to the database:

kql

I followed the instructions in the official documentation, but it shows up as a failure straight away.

image

Question Feedback

However, you don't need to feel worried during the installation process, because the official GoldCura provides a corresponding problem forum. When encountering any difficulties, you can directly post on the forum for help, seeking professional support and answers, the forum address is:/forum。

image

So instead of using the secret-free login method for now, let's just log in using the default account and password we just set.

ksql -Usystem -d test -p54321

image

Since the database doesn't exist, we can just log in and create a database called "system", and then use theksqlcommand for password-free login. This method is not only easy, but also improves our work efficiency.

As for the reason I don't really like using the command line, it's because command line operation requires configuration of multiple environment information, which increases the possibility of errors. In addition, the command line method may cause inconvenience in future cluster management. Currently, all operations colleagues tend to use Kubernetes for management, so Docker has become the mainstream installation method. This not only simplifies the deployment process, but also better adapts to modern O&M needs.

mirror push

As you can see, the official image is not uploaded to the official Docker repository, which means we need to go to the official website to download the image every time. This approach is very inconvenient to operate, especially when switching frequently between different machines. Therefore, we decided to maintain an image repository of our own for more efficient management and deployment.

Not only does this greatly simplify our process, but it also ensures that we have quick access to the mirrors we need when we need them. Currently, I use Tencent Cloud as my primary platform and it's free to use for personal instances.

image

Create a mirror repository:

image

We configure the repository address in our own local pagoda panel:

image

Pushing the mirrors we've already imported to our own repository is a relatively simple but crucial step. Through this process, we can ensure that these mirrors are quickly accessible when needed, which can greatly increase productivity.

image

publicly owned warehouse

I have successfully pushed the mirrors to my own public repository. This means that in future operations, if you don't want to download mirrors directly from the official website, you can also choose to download the required mirrors directly.

version: "2"
services.
  kingbase.
    image: /kingbase/database:v030
    container_name: kingbase-v030
    privileged: true # Note that the indentation here is aligned with the previous key-value pairs.
    environment.
      - ENABLE_CI=yes # yes (default case insensitive)/no case sensitive
      - NEED_START=yes # yes (default start database)/ no (do not start database)
      - DB_USER=system # default user name
      - DB_PASSWORD=12345678ab # default password
      - DB_MODE=oracle # support oracle/pg/mysql
    volumes.
      - /mnt/kingbase/data:/home/kingbase/userdata
    ports: /mnt/kingbase/data:/home/kingbase/userdata
      - 4322:54321
    restart: unless-stopped
    command: /usr/sbin/init

Since we already have a running database instance, this causes the current new service to not start properly.

image

summarize

In this process, we deeply felt the importance of Docker as a modern development and operation and maintenance tool. From standalone installation to image management, every step reflects its efficiency and flexibility. Docker not only simplifies environment configuration, but also facilitates team collaboration and resource sharing.

In practice, although we may encounter various problems, such as image import failures or hiccups in the startup process, these are all part of the growth process. With effective problem feedback and community support, we can quickly find solutions and avoid repeating mistakes.


I'm Rain, a Java server-side coder, studying the mysteries of AI technology. I love technical communication and sharing, and I am passionate about open source community. I am also a Tencent Cloud Creative Star, Ali Cloud Expert Blogger, Huawei Cloud Enjoyment Expert, and Nuggets Excellent Author.

💡 I won't be shy about sharing my personal explorations and experiences on the path of technology, in the hope that I can bring some inspiration and help to your learning and growth.

🌟 Welcome to the effortless drizzle! 🌟