In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use Rancher in linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Introduction to Rancher
Rancher is a comprehensive container management platform that makes it easier for containers to deploy and run in production environments on a variety of infrastructure platforms. It provides infrastructure services such as multi-host networks, global / local load balancing, and volume snapshots. It integrates the management capabilities of native Docker, such as Docker Machine and Docker Swarm. It provides a rich user experience that allows DevOps administrators to run Docker on a larger production environment.
Visit the following article to learn about installing Docker on Linux systems.
Recommended reading:
How to install Docker on Linux
How to use Docker mirroring on Linux
How to use Docker containers on Linux
How to install and run applications in a Docker container
Rancher characteristics
Kubernetes can be installed in two minutes.
Launch apps with one click (90 popular Docker apps).
It is easier to deploy and manage Docker.
Comprehensive production-level container management platform.
Containers can be quickly deployed in a production environment.
Powerful automated deployment and operation of container technology.
Modular infrastructure services.
Rich choreography tools.
Rancher supports multiple authentication mechanisms.
How to install Rancher
Because Rancher runs as a lightweight Docker container, its installation is very simple. Rancher is deployed by a set of Docker containers. Simply start two containers to run Rancher. One container acts as the management server and the other acts as a proxy on each node. You can deploy Rancher by simply running the following command on the Linux system.
The Rancher server provides two different installation package tags such as stable and latest. The following command will pull the appropriate Rancher image and install it on your operating system. It only takes two minutes for the Rancher server to start.
Latest: this tag is their developer build. These builds will be validated by Rancher CI's automation framework and are not recommended for use in production environments.
Stable: this is a stable release of * * and is recommended for use in production environments.
There are many ways to install Rancher. In this tutorial we discuss only two methods.
Install Rancher as a single container (embedded Rancher database)
Install Rancher (external database) as a single container
Method-1
Run the following command to install the Rancher server (embedded database) in a single container
$sudo docker run-d-- restart=unless-stopped-p 8080 rancher/server:stable$ sudo docker run-d-- restart=unless-stopped-p 8080 rancher/server:latest method-2
Instead of using your own internal database, you can point to an external database when you start the Rancher server. First create the required database, the database user is the same.
> CREATE DATABASE IF NOT EXISTS cattle COLLATE = 'utf8_general_ci' CHARACTER SET =' utf8'; > GRANT ALL ON cattle.* TO 'cattle'@'%' IDENTIFIED BY' cattle'; > GRANT ALL ON cattle.* TO 'cattle'@'localhost' IDENTIFIED BY' cattle'
Run the following command to start Rancher to connect to the external database.
$sudo docker run-d-- restart=unless-stopped-p 8080 rancher/server\-- db-host myhost.example.com-- db-port 3306-- db-user username-- db-pass password-- db-name cattle
If you want to test Rancher 2.0, use the following command to start it.
$sudo docker run-d-- restart=unless-stopped-p 80:80-p 443 rancher/server:preview access via GUI & install Rancher
The browser enters http://hostname:8080 or http://server_ip:8080 to access rancher GUI.
How to register a host
Register your host URL to allow it to connect to Rancher API. This is an one-time setting.
Next, click the "Add a Host" link under the main menu or click "INFRASTRUCTURE > > Add Hosts" on the main menu, and click the "Save" button.
By default, access control authentication in Rancher forbids access, so we first need to turn on access control authentication in some way, otherwise no one can access GUI.
Click "> > Admin > > Access Control", enter the following values * and click the "Enable Authentication" button to open it. In my case, it is opened by "local authentication".
"Login UserName": enter the login name you expect
"Full Name": enter your full name
"Password": enter the password you expect
"Confirm Password": confirm the password again
Log out and log back in with the new login credentials:
Now, I can see that the local authentication has been turned on.
How to add a host
After registering your host, it will take you to the next page, where you can select Linux hosts from different cloud service providers. We will add a host to run the Rancher service, so select the "custom" option and enter the necessary information.
Enter the public IP of your server in step 4, run the commands listed in step 5, and * click the "close" button.
Sudo docker run-e CATTLE_AGENT_IP= "192.168.56.2"-- rm-- privileged-v / var/run/docker.sock:/var/run/docker.sock-v / var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.11 http://192.168.56.2:8080/v1/scripts/16A52B9BE2BAB87BB0F5:1546214400000:ODACe3sfis5V6U8E3JASL8jQ INFO: Running Agent Registration Process CATTLE_URL= http://192.168.56.2:8080/v1INFO: Attempting to connect to: http://192.168.56.2:8080/v1INFO: http://192.168.56.2:8080/v1 is accessibleINFO: Configured Host Registration URL info: CATTLE_URL= http://192.168.56.2:8080/v1 ENV_URL= http://192.168.56.2:8080/v1INFO: Inspecting host capabilitiesINFO: Boot2Docker: falseINFO: Host writable: trueINFO: Token: xxxxxxxxINFO: Running registrationINFO: Printing EnvironmentINFO : ENV: CATTLE_ACCESS_KEY=9946BD1DCBCFEF3439F8INFO: ENV: CATTLE_AGENT_IP=192.168.56.2INFO: ENV: CATTLE_HOME=/var/lib/cattleINFO: ENV: CATTLE_REGISTRATION_ACCESS_KEY=registrationTokenINFO: ENV: CATTLE_REGISTRATION_SECRET_KEY=xxxxxxxINFO: ENV: CATTLE_SECRET_KEY=xxxxxxxINFO: ENV: CATTLE_URL= http://192.168.56.2:8080/v1INFO: ENV: DETECTED_CATTLE_AGENT_IP=172.17.0.1INFO: ENV: RANCHER_AGENT_IMAGE=rancher/agent:v1.2.11INFO: Launched Rancher Agent: e83b22afd0c023dabc62404f3e74abb1fa99b9a178b05b1728186c9bfca71e8d
Wait a few seconds and the newly added host will appear. Click the Infrastructure > > Hosts page.
How to view containers
Just click on the location below to list all containers. Click the Infrastructure > > Containers page.
How to create a container
It's very simple, just click on the following location to create the container.
Click "Infrastructure > > Containers > > Add Container" and enter each information you need. For testing, I will create a CentOS container for the latest tag.
In the same list location, click "Infrastructure > > Containers".
Click on the container name to show the performance information of the container, such as CPU, memory, network, and storage.
Select a specific container, and then click the rightmost "three points" button or click the "Actions" button to manage the container, such as stop, start, clone, restart, etc.
If you want to access the container in the console, just click the "Execute Shell" option in the "Actions" button.
How to deploy a container from an application directory
Rancher provides a directory of application templates to make deployment easy with a single click. It maintains most popular applications contributed by the Rancher community.
Click "Catalog > > All > > Choose the required application", and * * click "Launch" to deploy.
This is the end of this article on "how to use Rancher in linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.