How Serverless Applications Manage Logs & Persistent Data

Head picture.jpg

Author | Jingxiao Alibaba Development Engineer
This article is compiled from "Serverless Technology Open Course" *

Introduction : This section of the course has three parts, which respectively introduce the real-time log, file log and persistent storage of application data through NAS on SAE.

Real-time log

Picture 1.png

First, SAE supports viewing the real-time logs of each Pod under the application instance group. When the application is abnormal, you can locate the problem by viewing the real-time log of the Pod. When the application is running, you can conveniently view the real-time log of the application instance under the [Console-Log Management Menu-Real-time Log Submenu].

File log

Picture 2.png

SAE collects business file logs (excluding stdout and stderr logs) and enters them into the SLS, enabling unlimited line-viewing logs, self-aggregating and analyzing logs, facilitating business log docking, and billing based on log usage.

You can configure the log collection service when deploying the application and fill in the log source that needs to be collected. For the rolling log scenario, you can fill in the wildcard to solve it.

Picture 3.PNG

When the configuration is completed, you can easily see the collected file logs in [Console-Log Management Menu-File Log Submenu].

NAS persistent storage

Picture 4.png

Because the data stored in the container is non-persistent, SAE supports the NAS storage function, which solves the problems of application instance data persistence and multi-read shared data between instances.

You can configure persistent storage by deploying applications, select the created NAS, and fill in the corresponding mount path in the container.

Picture 5.PNG

After the configuration is complete, you can use the cat /proc/mount | grep nfs command to check whether the mount is successful, or you can prepare 2 application instances, A and B, to mount the NAS separately. Execute the write command echo "hello"> tmp.txt for A, and execute the read command cat tmp.txt for B. If B can read the hello written in A, it means that the NAS is successfully mounted.

The Serverless official account releases the latest information on Serverless technology, gathers the most complete content of Serverless technology, pays attention to the trend of Serverless, and pays more attention to the confusion and problems you encounter in your practice.

Guess you like

Origin blog.51cto.com/14902238/2562974
Recommended