Amazon Keyspace에서 키스페이스 생성 - Amazon Keyspaces(Apache Cassandra용)

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

Amazon Keyspace에서 키스페이스 생성

이 섹션에서는 콘솔, cqlsh 또는 AWS CLI를 사용하여 키스페이스를 생성합니다.

참고

시작하기 전에 자습서 사전 조건을 모두 구성해야 합니다.

키스페이스는 하나 이상의 애플리케이션과 관련된 관련 테이블을 그룹화합니다. 키스페이스는 하나 이상의 테이블을 포함하며 포함된 모든 테이블의 복제 전략을 정의합니다. 키스페이스에 대한 자세한 내용은 다음 주제를 참조하세요.

이 자습서에서는 단일 리전 키스페이스를 생성하고 키스페이스의 복제 전략은 SingleRegionStrategy입니다. Amazon Keyspaces는 SingleRegionStrategy를 사용하여 하나의 AWS 리전에서 3개의 가용 영역에 데이터를 복제합니다. 다중 리전 키스페이스를 생성하는 방법을 알아보려면 Amazon Keyspaces에서 다중 리전 키스페이스 생성 섹션을 참조하세요.

콘솔을 사용하여 키스페이스를 생성하려면
  1. AWS Management Console에 로그인하고 Amazon Keyspaces 콘솔(https://console.aws.amazon.com/msk/home)을 엽니다.

  2. 탐색 창에서 Keyspaces를 선택합니다.

  3. 키스페이스 생성을 선택합니다.

  4. 키스페이스 이름 상자에 키스페이스 이름으로 catalog를 입력합니다.

    이름 제약 조건:

    • 이름은 비워둘 수 없습니다.

    • 허용되는 문자: 영숫자 및 밑줄(_)

    • 최대 길이는 48자입니다.

  5. AWS 리전에서 단일 리전 복제가 키스페이스의 복제 전략인지 확인합니다.

  6. 키스페이스를 만들려면 키스페이스 생성을 선택합니다.

  7. 다음을 수행하여 catalog 키스페이스가 생성되었는지 확인합니다.

    1. 탐색 창에서 Keyspaces를 선택합니다.

    2. 키스페이스 목록에서 catalog 키스페이스를 찾습니다.

다음 절차는 CQL을 사용하여 키스페이스를 생성합니다.

CQL을 사용하여 키스페이스를 만들려면
  1. AWS CloudShell을 열고 다음 명령을 사용하여 Amazon Keyspaces에 연결합니다. us-east-1을 자체 리전으로 업데이트해야 합니다.

    cqlsh-expansion cassandra.us-east-1.amazonaws.com 9142 --ssl

    해당 명령의 결과는 다음과 같아야 합니다.

    Connected to Amazon Keyspaces at cassandra.us-east-1.amazonaws.com:9142 [cqlsh 6.1.0 | Cassandra 3.11.2 | CQL spec 3.4.4 | Native protocol v4] Use HELP for help. cqlsh current consistency level is ONE.
  2. 다음 CQL 명령을 사용하여 키스페이스를 생성합니다.

    CREATE KEYSPACE catalog WITH REPLICATION = {'class': 'SingleRegionStrategy'};

    SingleRegionStrategy는 복제 요소 3을 사용하고 해당 리전의 3개 AWS 가용 영역에 데이터를 복제합니다.

    참고

    Amazon Keyspaces는 따옴표로 입력하지 않는 한 기본적으로 모든 입력을 소문자로 사용합니다.

  3. 키스페이스가 생성되었는지 확인합니다.

    SELECT * from system_schema.keyspaces;

    이 명령의 출력은 다음과 비슷해야 합니다.

    cqlsh> SELECT * from system_schema.keyspaces; keyspace_name | durable_writes | replication -------------------------+----------------+------------------------------------------------------------------------------------- system_schema | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} system_schema_mcs | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} system | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} system_multiregion_info | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} catalog | True | {'class': 'org.apache.cassandra.locator.SimpleStrategy', 'replication_factor': '3'} (5 rows)

다음 절차는 AWS CLI를 사용하여 키스페이스를 생성합니다.

AWS CLI를 사용하여 키스페이스를 만들려면
  1. 환경이 설정되었는지 확인하기 위해 CloudShell에서 다음 명령을 실행할 수 있습니다.

    aws keyspaces help
  2. 다음 AWS CLI 문을 사용하여 키스페이스를 생성합니다.

    aws keyspaces create-keyspace --keyspace-name 'catalog'
  3. 다음 AWS CLI 문으로 키스페이스가 생성되었는지 확인합니다.

    aws keyspaces get-keyspace --keyspace-name 'catalog'

    이 명령의 출력은 이 예제와 비슷해야 합니다.

    { "keyspaceName": "catalog", "resourceArn": "arn:aws:cassandra:us-east-1:123SAMPLE012:/keyspace/catalog/", "replicationStrategy": "SINGLE_REGION" }