Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to enable instance based storage for data nodes #134

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

rishabh6788
Copy link
Collaborator

@rishabh6788 rishabh6788 commented Sep 27, 2024

Description

This PR adds support to mount instance-based storage disk for data node instance types that support this feature.
These are SSD nvme volumes attached to ec2 instance that provide better iops and throughput compared to ebs volumes.

We have added a new context parameter useInstanceBasedStorage to allow user to be able to mount these volumes and use them to run OpenSearch service.

This is only enabled for data-nodes in both single-node cluster and multi-node cluster mode.

This PR also adds the change to replace ASG Launch configuration with Launch Templates as the former is getting deprecated and doesn't support ec2 instance types released after Dec-31, 2022. See https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/

Issues Resolved

#132

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

{
ignoreErrors: false,
}));
currentWorkDir = '/mnt/data';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does this mean that now opensearch will be installed at /mnt/data folder for both instance based storage? and for all others it will be at /home/ec2-user?

Copy link
Collaborator Author

@rishabh6788 rishabh6788 Sep 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if instance based storage then the nvme1n1 disk will be mounted on /mnt/data path and OS will be started in that path, if not selected then everything will remain as usual.
Mounting existing /home/ec2-user also works but it is not the ideal way.
We should be unmouting it first and then mount it again, and by any chance if that disk is busy it will cause failures and make the process cumbersome.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it make sense. Can we add this information in the readme?

Copy link
Contributor

@navneet1v navneet1v left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me!! thanks for adding this support. Cannot wait to test disk based vector search features by creating cluster with cluster CDK

@rishabh6788
Copy link
Collaborator Author

@gaiksaya This PR also adds the change to replace ASG Launch configuration with Launch Templates as the former is getting deprecated and doesn't support ec2 instance types released after Dec-31, 2022. See https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/

volume: BlockDeviceVolume.ebs(50, { deleteOnTermination: true, volumeType: props.storageVolumeType }),
}],
requireImdsv2: true,
userData: UserData.forLinux(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confused about forLinux() here. Looks like userdata is optional right? https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.LaunchTemplate.html#userdata and all installations we are running via cfnInit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not optional when using LaunchTemplate, this needs to be declared. This adds below:

UserData:
          Fn::Base64:
            Fn::Join:
              - ""
              - - |-
                  #!/bin/bash
                  # fingerprint: 1ef4754d2d6b55e6
                  (
                    set +e
                    /opt/aws/bin/cfn-init -v --region
                - Ref: AWS::Region
                - " --stack "
                - Ref: AWS::StackName
                - |-2
                   --resource dataNodeAsgASGA92884EE -c default
                    /opt/aws/bin/cfn-signal -e $? --region
                - Ref: AWS::Region
                - " --stack "
                - Ref: AWS::StackName
                - |-2
                   --resource dataNodeAsgASGA92884EE
                    cat /var/log/cfn-init.log >&2
                  )
                  

This was getting added previously as part of Launch Configuration.

@gaiksaya
Copy link
Member

@gaiksaya This PR also adds the change to replace ASG Launch configuration with Launch Templates as the former is getting deprecated and doesn't support ec2 instance types released after Dec-31, 2022. See https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/

Thanks! Can you bump the version accordingly (major or minor depending on breaking changes). Would need to consume new version in nightly playgrounds.
Thanks!
https://github.com/opensearch-project/opensearch-cluster-cdk/blob/main/package.json#L3

@rishabh6788
Copy link
Collaborator Author

@gaiksaya This PR also adds the change to replace ASG Launch configuration with Launch Templates as the former is getting deprecated and doesn't support ec2 instance types released after Dec-31, 2022. See https://aws.amazon.com/blogs/compute/amazon-ec2-auto-scaling-will-no-longer-add-support-for-new-ec2-features-to-launch-configurations/

Thanks! Can you bump the version accordingly (major or minor depending on breaking changes). Would need to consume new version in nightly playgrounds. Thanks! https://github.com/opensearch-project/opensearch-cluster-cdk/blob/main/package.json#L3

Done!

Copy link
Member

@gaiksaya gaiksaya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants