In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What is the operation of Launch and Shut Off? in order to solve this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
Analyze instance launch and shut off operations, and tips on how to quickly locate useful information in logs.
Launch
Launch instance should be the most important operation of Nova.
A careful study of lanuch operations can help us fully understand the coordination and operation mechanism of Nova sub-services.
We have discussed the various nova-* sub-services in detail earlier, taking the launch operation as an example. I won't repeat it here, just review the process again.
The customer (either an OpenStack end user or another program) sends a request to API (nova-api): "help me create an Instance"
After doing some necessary processing on the request, API sends a message to Messaging (RabbitMQ): "Let Scheduler create an Instance"
Scheduler (nova-scheduler) gets the message sent by API from Messaging, and then executes the scheduling algorithm to select node A from several computing nodes.
Scheduler sent a message to Messaging: "create this Instance on compute node A."
The Compute (nova-compute) of compute node A gets the message sent to it by Scheduler from Messaging, and then creates an Instance through the Hypervisor Driver of this node.
During the creation of Instance, if Compute needs to query or update database information, it will send a message to Conductor (nova-conductor) through Messaging, and Conductor is responsible for database access.
Shut Off
Here is the flow chart of shut off instance
Send a request to nova-api
Nova-api sends messages
Nova-compute executes the operation
Let's discuss each step in detail.
Send a request to nova-api
Customers (either OpenStack end users or other programs) send a request to API (nova-api): "help me shut down this Instance"
View log / opt/stack/logs/n-api.log
Here's a few more words about how to quickly find useful information in log files. For beginners, this is not an easy task, because there are a lot of entries and content in the log, especially when the debug option is turned on, it is easy to dazzle and have no way to start.
Here are a few tips:
Identify a large range first, such as printing log files with tail-f before the operation, so that the logs you need to view must be in the printout after the operation. You can also use a timestamp to determine the range of logs you need.
Use the "code module" to quickly locate useful information. Each nova-* sub-service has its own specific code module:
Nova-api
Nova.api.openstack.compute.servers
Nova.compute.api
Nova.api.openstack.wsgi
Nova-compute
Nova.compute.manager
Nova.virt.libvirt.*
Nova-scheduler
Nova.scheduler.*
Use Request ID to find relevant log information. In the log above, we can use the Request ID of "req-1758b389-a2d0-44cc-a95a-6f75e4dc07fd" to quickly locate other log entries in n-api.log that are similar to shut off operations. It is important to add that Request ID is cross-log files, and this feature can help us find relevant information in the log files of other sub-services. We will see the application of this technique in a moment.
Nova-api sends messages
Nova-api sends a message to Messaging (RabbitMQ): "close this Instance." nova-api does not log the operation of sending the message, but we can verify it by looking at the source code. When it comes to source code, you might think you're looking for a needle in a haystack. In fact, it is very simple, the above log has clearly told us that the source code we need to view is on line 1977 of / opt/stack/nova/nova/compute/api.py, and the method is force_stop.
The last thing the force_stop method calls is the stop_instance method of the object self.compute_rpcapi. In the OpenStack source code, the object named after xxx_rpcapi represents the message queue of xxx. The xxx_rpcapi.yyy () method indicates that a message for the yyy operation is sent to the message queue of the xxx.
So the purpose of self.compute_rpcapi.stop_instance () is to send a stop instance message to the message queue of nova-compute on RabbitMQ.
I would like to add here: the prerequisite for shutting down instance is that instance is already running on a computing node, so there is no need for nova-scheduler to help us select the appropriate node, which is different from launch operation.
Nova-compute executes the operation
View the log / opt/stack/logs/n-cpu.log on the compute node
Here we take advantage of Request ID "req-1758b389-a2d0-44cc-a95a-6f75e4dc07fd" to quickly locate the log entry in n-cpu.log where nova-compute closes instance.
When analyzing an operation, we first need to sort out the internal process of the operation, and then go to the appropriate node to view the log. For example, the process of shut off is:
Send a request to nova-api
Nova-api sends messages
Nova-compute executes the operation
1Jing 2 the two steps are performed on the control node to view the nova-api log. Step 3 is performed on the compute node to view the log of nova-compute.
This is the answer to the question about the operation of Launch and Shut Off. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.