建议使用更多的较小实例,因为它们可以更好地适应高度动态的工作负载。而且,它们还具有弹性,能够自动缩放以适应不同的工作量。以下是一个示例代码,它使用AWS CloudFormation部署一个包含4个t2.micro实例的OpenSearch集群。
AWSTemplateFormatVersion: '2010-09-09'
Resources:
OpenSearchCluster:
Type: 'AWS::OpenSearchService::Domain'
Properties:
DomainName: my-opensearch-domain
ElasticsearchVersion: '7.10'
ElasticsearchClusterConfig:
InstanceType: t2.micro.opensearch
InstanceCount: 4
DedicatedMasterEnabled: true
DedicatedMasterCount: 3
ZoneAwarenessEnabled: true
ZoneAwarenessConfig:
AvailabilityZoneCount: 2
EBSOptions:
EBSEnabled: true
VolumeType: gp2
VolumeSize: 10
AccessPolicies:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
AWS: '*'
Action: 'es:*'
Resource: '*'
Outputs:
OpenSearchClusterEndpoint:
Description: The endpoint of the OpenSearch cluster
Value: !Sub 'https://${OpenSearchCluster.DomainName}'