Clickhouse doesn't show new size after EBS volume resizing - clickhouse

We have Clickhouse running on EC2 with EBS volume attached. We successfully increased disk size using AWS guide which works flawless.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
But using Clikhouse
SELECT * FROM system.disks; We do see the old size of disk.
We also stopped and started server again. In config.xml I couldn't find and disk space related configuration.

Related

Running out of disk space EC2

I ran into some issues with my EC2 micro instance and had to terminate it and create a new one in its place. But it seems even though the old instance is no longer visible in the list, it is still using up some space on my disk. My df -h is listed below:
Filesystem Size Used Avail Use%
/dev/xvda1 7.8G 7.0G 719M 91% /
When I go to the EC22 console I see there are 3 volumes each 8gb in the list. One of them is attached (/dev/xvda) and this one is showing as "in-use". The other 2 are simply showing as "Available"
Is the terminated instance really using up my disk space? If yes, how to free it up?
I have just solved my problem by running this command:
sudo apt autoremove
and a lot of old packages are going to be removed, for instance many files like this linux-aws-headers-4.4.0-1028
Amazon Elastic Block Storage (EBS) is a service that provides virtual disks for use with Amazon EC2. It is network-attached storage that persists even when an EC2 instance is stopped or terminated.
When launching an Amazon EC2 instance, a boot volume is automatically attached to the instance. The contents of the boot volume is copied from an Amazon Machine Image (AMI), which can be chosen from a pre-populated list (including the ability to create your own AMI).
When an Amazon EC2 instance is Stopped, all EBS volumes remain attached to the instance. This allows the instance to be Started with the same configuration as when it was stopped.
When an Amazon EC2 instance is Terminated, EBS volumes might or might not be deleted, based upon the Delete on Termination setting of each volume:
By default, boot volumes are deleted when an instance is terminated. This is because the volume was originally just a copy of an AMI, so there is unlikely to be any important data on the volume. (Hint: Don't store data on a boot volume.)
Additional volumes default to "do not delete on termination", on the assumption that they contain data that should be retained. When the instance is terminated, these volumes will remain in an Available state, ready to be attached to another instance.
So, if you do not require any content on your remaining EBS volumes, simply delete them. In future, when launching instances, keep an eye on the Delete on Termination setting to make the clean-up process simpler.
Please note that the df -h command is only showing currently-attached volumes. It is not showing the volumes in Available state, since they are not visible to that instance. The concept of "Disk Space" typical refers to the space within an EBS volume, while "EBS Storage" refers to the volumes themselves. So, the 7GB of the volume that is used is related to that specific (boot) volume.
If you are running out of space on an EBS volume, see: Expanding the Storage Space of an EBS Volume on Linux. Expanding the volume involves:
Creating a snapshot
Creating a new (bigger) volume from the snapshot
Swapping the disks (requiring a Stop/Start if you are swapping a boot volume)
These 2 steps add an extra hard drive to your EC2 and format it for use:
Attach an extra hard drive (EBS: Elastic Block Storage) to an EC2
Format an EBS drive attached to an EC2
Here's pricing info. Free Tier includes 30GB. Afterward it's $1.25/month for 10GB on a General Purpose SSD (gp2).
To see how much space you are using/need:
Check your current disk use/available in Linux with df -h.
Check the size of a directory in Linux with du -sh [path].

EC2 Create Image EBS volume seems to remain the same

Production went down today with no disk space remaining error. After deleting files and restarting the machine, it still came up with this error, even if I just try to touch a new empty file.
It is probably caused by running out of inodes, but I went ahead and created an "Image" which seems to create an AMI, but after launching an instance of the AMI the same problem persisted... probably because it is using the same EBS volume.
Question is: how do I snapshot the EBS volume and then connect a new volume to the AMI as the root fs?
You care correct that the "Create Image" command creates an Amazon Machine Image (AMI). If you start a new EC2 instance with this AMI, it will contain the same data as the machine that was imaged. That's why you are copying your exiting problem to the new instance.
Check your disk space with df -h to confirm that you have space available.
If you require more disk space, you can copy your disk to a larger volume as follows:
Option 1: If you already have an AMI of the volume:
Launch a new instance using the AMI, but expand the size of the volume in the Add Storage options
Option 2: If you want to retain the same instance:
Stop your instance
Create Snapshot of the EBS Volume
Create Volume from the Snapshot, specifying a larger storage size
Detach the original root volume
Attach the new volume in its place (keep the same Device identifier)
In both cases, after startup confirm that the partition has automatically expanded. If not, use the resize2fs command to extend the partition.
When you create an image of an ec2 instance, it takes snapshots of the volumes also. You can see this in "Images > AMIs" and snapshots information is visible in "Block Devices" column (By default, this column is not visible) of the table.
Now, if you are getting the "no disk space error", you need to increase the size of root volume. You can do that by following the link below:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-expand-volume.html

MapR on Ubuntu 12.0.4 - Disk setup on EC2

I see these steps in seting up the disk for MapR installation at link
To determine if a disk or partition is ready for use by MapR:
Run the command sudo lsof to determine whether any processes are
already using the disk or partition.
There should be no output when running sudo fuser , indicating there is no > process accessing the specific disk or partition.
The disk or partition should not be mounted, as checked via the output of the mount ?command.
The disk or partition should not have an entry in the /etc/fstab file.
The disk or partition should be accessible to standard Linux tools such as
mkfs. You should be able to successfully format the partition using a
command like sudo mkfs.ext3 as this is similar to the
operations MapR performs during installation. If mkfs fails to access
and format the partition, then it is highly likely MapR will encounter
the same problem.
I have issues in acheiving this on amazon EC2 instance.
Steps that i have tried
I have created a large EC2 instance.
Created the snapsot of that volume associated with that instance
Created a new volume with 500 GB from the snapshot created above
I am not sure, how to unmount this new volume and make it available for MapR. I also see an entry in /etc/fstab for this new volume.
Can some one give a step-by-step approach to create a disk or partition which satisfies the above mentioned criteria for MapR?
MapR runs on raw disks, eg, directly on /dev/sdb. Use the disksetup command to add disks to MapR. See http://mapr.com/doc/display/MapR/disksetup for information on how to use.

Create directory structure in Amazon Elastic Block Storage(EBS) and save files from Java Servlets?

I am very new to this and trying to do this the first time. I have learned that Amazon Elastic Block Storage(EBS) can be used in a similar way as a hard Disk when mounted on Amazon EC2. Now I wish to create a directory structure in EBS and save files from Java Servlet in EBS?
I have also learned that the code used by the servlet in development machine can be used to create a directory structure access files in EBS also
#MultipartConfig( location = "d:\\tmp",
fileSizeThreshold = 1024 * 1024,
maxFileSize = 1024 * 1024 * 5,
maxRequestSize = 1024 * 1024 * 5 * 5 )
I have Amazon Linux installed on my Amazon EC2, any pointers will be great help?
EBS isn't similar to a hard disk, it behaves exactly as a hard disk from the perspective of your application (except that it's slower than a desktop hard disk unless you stripe multiple EBS volumes into a software RAID configuration).
After you have mounted your EBS volume, you use the EBS storage exactly as you would any other storage.
Instructions on how to mount the volume for Linux can be found here:
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html
Following those steps, you would end up with a directory
/mnt/data-store
that corresponds to the EBS volume. If you don't like the name data-store you can change it to something else.
I did notice your example code refers to "d:\\tmp" which is a Windows path specification, but you state that your instance is running Linux. Be sure that you adjust any paths to point to /mnt/data-store.
The easiest way to start using an EBS volume is to launch an EBS-backed EC2 instance. Those come pre-connected to an EBS volume (it is the boot volume).

Can I create an AMI that includes multiple ebs volumes (i.e. both sda and sdb)

I have an ebs-backed instance running on EC2. I'm using it to do some computationally intensive text processing on around 16Gb of data which is stored on sdb (i.e. the larger ebs volume associated with the instance).
I'd like to parallelized the processing by creating replicas of this instance, each with its own copy of the data. I can create an AMI from the instance but I need the image to include BOTH sda (the root ebs volume) AND ALSO sdb, which is the volume where all the data is. How can I make a replica of the whole package?
Creating an image in the AWS Management Console just copies sda (i.e. the root volume, which is too small to hold my data).
Is this even possible?
(PS: I don't even see the sdb volume in the AWS Management Console Elastic Block Store->Volumes panel)
Thanks!
I once needed this sort of setting where I had to setup a MySQL on a EBS backed machine with data store in a separate EBS Volume. The AMI had to be such that every time you instanciate it, it should have the data volume (with static data in it) attached. This is how I did:
Created an EBS backed instance from any existing image
Attached a EBS volume, performed mkfs, mounted on /database
Copied data to the volume, e.g. under /database/mysql
Created image of this setup from AMI web console.
Now, every time I launch this image, I see the volume with all the data is there. I just mount it on /database and things get going.
I am not sure, if this is helpful to you but your problem seemed to close to this.
Update after #NAD's comment
Yeah, AMI creation process excludes stuffs that are under
/sys
/proc
/dev
/media
/mnt
So, the trick is to not have stuffs that you want to bundle up with your AMI under these directories.
Also, if you have volume that you want to auto-mount at boot, register it in fstab

Resources