Hi Udara, Thanks a lot for the information.
Will create a seperate page including these details in the wiki. On Fri, Apr 18, 2014 at 10:30 AM, Udara Liyanage <[email protected]> wrote: > Hi, > > I thought of summarizing this since this has discussed in several mailing > threads. > > Please correct if you see anything missing in this mail. > > *Use case *: Adding persistence volume is very much similar to adding a > virtual hard drive to your instance.In Amazon EC2 it is adding a EBS > storage device to the instance. Please refer to [1] for more details. > Persistence volume capability comes handy when you want to store your > content in a separate place and make the data available even after the > instance is terminated or deleted. MySQL, MongoDB are examples where you > may need this capability. > > Below are the steps you need to perform to enable persistence volume > mapping capability. > > * *Cartridge Definition* > You need to add a similar configuration to the cartridge definition. > Please note that the persistence is an optional configuration which user > specify if he wants additional volumes to store his content. > > "persistence": { > "isRequired": true, > "volume" : [ > { > "device": "/dev/sdc", > "mappingPath": "/home/ubuntu/sdc", > "size": "10", > "removeOnTermination": "false" > } > ] > } > > Here I say I want an extra volumes to store my content. Linux device of > the first volume should be /dev/sdc which will be mounted to the directory > /home/ubuntu/sdc. The capacity of the volume should be 10GB. > removeOnTermination parameter specify what should be done to the volume > created after the termination of the instance. if removeOnTermination=false > the volume and its data will exist even after the volume is terminated so > data is not deleted. > > * *Subscribe with persistence volumes * > Just by adding to the cartridge definition does not provide volumes for > the instances. We have to specify we require volumes at the time of > subscribing. > > * by CLI > [2] shows how to subscribe with persistence mappings > * by UI > If you are subscribing with the Stratos Ui, there is tick > as "persistence mappings" on the "subscribe to cartridge" page. Please tick > it and provide required details. > > * *Multiple persistence volumes* > > Stratos provides the capability to specify multiple persistence volumes in > case you require more that one additional volume. > > "persistence": { > "isRequired": true, > "volume" : [ > { > "device": "/dev/sdc", > "mappingPath": "/home/ubuntu/sdc", > "size": "10", > "removeOnTermination": "false" > }, > { > "device": "/dev/sdf", > "mappingPath": "/home/ubuntu/sdf", > "size": "20", > "removeOnTermination": "false" > } > ] > } > > Note that don't specify the same mappingPath to multiple volumes. Then it > will be mapped to the last volume which can not be predicted, other volumes > will not be mapped to a directory. > > *What happens behind the scene.* > > If you subscribe with persistence mappings, Stratos will, > 1 Create the volumes. > 2 Format and create a writable file system (ext3) > 3 Mount volumes to the directory specified as mappingPath > Please note that the formatting and creating a file system happens at the > first time only. Next time when the volume is attaching to another instance > (after first instance is terminated), it is no longer needed to create a > file system since file system is already there. > > * *How to verify if the volumes are created.* > > Log in to the instance created by ssh and execute the command "df -h". You > will see a output similar to below. > > df -h > Filesystem Size Used Avail Use% Mounted on > /dev/xvdc 10G 7.1G 97G 3% /home/ubuntu/sdc > /dev/sda1 4000G 40G 320G 10% /home > > * *Limitations.* > > In most IAASes such as EC2 one volume can be attached to only one > instance. So if your deployment policy has maxInstance count more than 1, > you might encounter problems when Stratos tries to attach the the volume to > the second instance. > > This has tested only in EC2, need to be tested in other IAASes as well. > > * *Improvements* > > Currently size parameter is mandatory at the time of subscription. But in > ideal case the size specified in cartridge definition should be considered > as the default if the size is not given at the time of subscription. > > > [1] > http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-attaching-volume.html > > > > -- > > Udara Liyanage > Software Engineer > WSO2, Inc.: http://wso2.com > lean. enterprise. middleware > > web: http://udaraliyanage.wordpress.com > phone: +94 71 443 6897 > -- Thanks & Best Regards, *Praneesha Chandrasiri* *Technical Writer* *WSO2 Inc. * *Mobile: +(94) 718156888* *E-mail: [email protected] <[email protected]>*
