Chapter 4 Script
Chapter 4 Script
In this
chapter, we will introduce how to deal with some common requirements in daily
operational work.
Let's take a look at two operational scenarios. One is to recover data that was
carelessly deleted. I think many IT guys encounter this situation as part of their daily
work.
If you are using a traditional server, you need to have a backup of the data and then
recover from the backup. This requires professional skills in data backup and
recovery.
Scenario two is about real-time monitoring for a server at a notification when the
workload is high. This is also a common task for traditional servers. You need to
develop a monitor and notification too about this requirement.
With Alibaba Cloud, only five minutes is needed for such a case, all operations can
be done on console with a few clicks. First, let's take a look at how to deal with
scenario one.
Let's see if the solution is you can use the ECS snapshot feature to quickly and
easily restore deleted data. ECS snapshot is a copy of the data on a disk at a certain
time.
The most common usage of the snapshot is to back up data when an accident
happens like someone carelessly delete some data, it can be retrieved from a
snapshot. And please notice that users can set auto snapshot policies to back up
data automatically.
Here are the steps to using snapshots to retrieve the deleted data. First, you need
confirm disk of the target ECS instance, and then create a new file in the disk and
create the disks in the create the disk snapshot and stimulate deleting the file from
the remote terminal and then stop instance rule back the disk using the snapshot
and then and last is restored.
Instance, you can confirm the data has been recovered and recovered successfully.
Ok, let's do a demo about using snapshots to retrieve the data. Okay, let's start the
demo of using snapshots to retrieve deleted data.
Now, first, let us confirm the disk of the target ECS instance colleague to the
instance page and colleague, the target instance, ok, from this page, there's a menu
here, you can check the details since the disks and instep shot here.
So let's click the instance, and you can see that we have three disks here.
Ok, let's return to the instance page, connect to the confirmed the snapshot feature,
review. First, create a new file in the driver and then take a snapshot.
And the drops fell, and then use the snapshot to roll back the disk, and then check
whether the file has been recovered or not. So we will create a new file called the
shortest. Okay, I put some value here.
And okay, now we have a new file here. We will first return to the cloud, instance
page.
So we will create a snapshot for the UD driver that is twenty-five gigabytes. Ok, so
we will create a snapshot. You can click the create snapshot button input, a snapshot
cloud, snapshot.
After this operation, you can access the instant snapshots page to check the
snapshot details and status. Now we can see it is still in progress.
So according to the data site, the first time creating special operations may take
some time, but Alibaba Cloud, using incremental snapshot features to create a new
snapshot. So the second time you create it will not take much.
Okay, now the snapshot has been successfully created. Ok, so we will continue our
operation. We will return to the host.
And the fell we just created for testing, so deleted is fell, and I pretty recycle bin.
Okay, ok. Now the file may have been deleted by mistake.
How can we retrieve is now that's using disk feature here. So at the initial page
check the target snapshot you want. Uh, you want used to roll back the disk, collect
disc, and grow back.
Now, there is some notice here. So this grew back is only supported for stopping the
instance, and used for disks without snapshots being created. Because our instance
is still running, we will first return to the instance page and stop the instance.
Ok, the instance has been stopped now. Access instance, detail page, again, collect
the instance snapshot. I used this.
Click, this group back button. Now there's a checkbox here. It will start if you check
this option, then it will start the instance immediately after rollback, so they will check
this option.
Click, ok.
Okay.
New instance page, you can check the status has been changed to starting. It
means that the disk grew. It's finished.
Okay, now let's connect to the target host to check whether the file has been
recovered, or not.
Can you input the password of the administrator user again and click this pc and
access? Oh, you can see that the file, we just deleted but has been recovered
successfully.
By using snapshots. You can also set up the auto snapshot policy. Go to automatic
snapshot policy under the snapshot image submenu.
Here you can create an automatic snapshot policy, click this button and input the
policy name, latest snapshot. Okay, here you can choose the time the snapshot has
been taken. So we will choose at eleven pm.
Ok, so for the retention period you can check, you can specify the during days all
you can check the prominent button to make the snapshot permanent.Ok.So we will
use the default value, click, ok.
So it will. There's notice here. So it tells you that you need to.
It is recommended that this could be set to exclude those automatic snapshot policy.
So we will set, ok, you can choose the disk you want to add into this automation,
automatic snapshot policy will check the data disk and click enable automatic
snapshot.
Okay, okay. Now everything we can check, click cloud disk. And so you can click the
automatic snapshot policy for each disk to check the detail.
Yeah, this disk has been added to the national policy's latest snapshot. And it will be,
it will create a new snapshot every day at eleven pm.
Let's take a look at how ECS deals with scenario 2. The user needs to monitor the
running status of ECS instances such as CPU usage, memory, disk, and network in
a traditional situation, the user needs to set up several monitoring and alarm systems
to do this job.
And here's a solution, is Alibaba cloud monitor can monitor all of the key metrics for
ECS instance in real-time. Cloud Monitor provides insights into CPU utilization and
other performance metrics of ECS instance without additional charge, the user can
confirm the view, time, status, and cafe, and configure alarm policies on the console.
Okay, here are our demo steps. First, they will confirm the mountain status on the
console, and then manage the alert contract and configure a large policy, send an
alert message to administrators when CPU usage reaches seventy percent.
Ok, let's do the quick demo. Ok, let's start the demo for ECS instance monitoring I
will show you in Alibaba cloud how you can confirm the monitor status of your
instance on the web UI console, and then show you how to manage alert
notifications, how to create a lot.
First, let's move to and ECS console, click, yes, and instance, so you can see there's
a monitor button here, you can review basic metrics. For this instance, you can see
there is a CPU usage and network usage here.
This is basic information for the detailed information of the existing. You can go to the
cloud monitor dashboard to check the detail. So somebody may have found that
there's no cloud monitor menu here, so you need to click this button.
And two.
Monitor and manage the menu here and click. Ok to let it display on the menu, click
the cloud monitor.
Ok, you can check, and that the detailed information on the dashboard, so you, if you
want to check the instance status, you need to click host monitoring. So it will list all
your instances here.
And here. Please be noticed that if you want to use cloud monitor 2, you need to
install an agent on your host here, you just need to click to install button. It may take
about one minute.
Ok, ok. The agent has been successfully installed on our ECS. Now you can click
the instance to check the detailed information like your usage, memory usage, and
some basic monitoring process monitoring. He can see there's a lot of information
here. Ok, if you want to add an alarm to the instance, for example, configure alert
policies, send an alert message to administrators than c u.
And the here to add one. First, you need to check related results.
He will use ECS and resource, choose instances. And this is the name used. Cloud
now is the threshold set, alarm, alarm, juice.
Ok, rule description here. You can choose CPU usage, CPU, idle time at a rate such
as that we will hear you see your usage and the average CPU usage uh for five
minutes is higher than seventy percent.
Now send a notification. Ok, so there is some other information here. Beautiful
means once an alarm occurs and the problem persists, the interval will send the
same, so we will use default value twenty-four hours here.
So the train triggered when the threshold is exceeded they will choose five times.
Ok, the effective period uses the default value frozen notification measure. They will
use a default, can contact the group here, colleague, the contact group, and move to
the selected groups.
Ok, notification message, you can choose email audio and you can use phone or
email, ID or other methods, you can write information about the email subject and
the now remark test CPU usage alert.
Ok, now this rule has been created, and the cloud monitor will monitor the status of
this instance. And if the CPU usage is seventy percent reaches seventy percent, it
will send alarms to the specified contact.
Ok, that's all for the disc, since monitoring demo, ok. After a quick demo, let's do a
quick recap of this chapter. So using the ECS snapshot feature, you can quickly and
easily restore deleted data.
Users can set auto snapshot policies to back up data automatically. You can also
configure proper monitor matrix and alarm policies to monitor the e c s running
status. So to operate is assistance.
You can use our account, or you can log in to your remote host using a remote
management feature. ECS supports various key solutions.
Here the oversea customers can see we have our customers in different industries
who are already using ECS as their server to provide their services. There are lots of
possibilities waiting for you to explore.
I think he's a good start to try seeing things first. Ok, that's all for the operate and
manage cloud server training.