gcloud CLI를 사용하여 Filestore 인스턴스 만들기
이 빠른 시작에서는 Google Cloud CLI를 사용하여 Identity and Access Management를 빠르게 시작하고 실행하는 방법을 보여줍니다. 이 빠른 시작에서 설명하는 사항은 다음과 같습니다.
- IAM 인스턴스를 만듭니다.
- 해당 인스턴스의 파일 공유를 Compute Engine 클라이언트 VM에 마운트합니다.
- 마운트된 파일 공유에서 파일을 만듭니다.
- IAM 인스턴스를 삭제합니다.
시작하기 전에
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
Install the Google Cloud CLI.
-
외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.
-
gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.
gcloud init -
Create or select a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith your Google Cloud project name.
-
이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Filestore API:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable file.googleapis.com
-
Install the Google Cloud CLI.
-
외부 ID 공급업체(IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.
-
gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.
gcloud init -
Create or select a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace
PROJECT_IDwith a name for the Google Cloud project you are creating. -
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace
PROJECT_IDwith your Google Cloud project name.
-
이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우 필요한 권한이 이미 있습니다.
-
Verify that billing is enabled for your Google Cloud project.
-
Enable the Filestore API:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable file.googleapis.com
-
Filestore 인스턴스 만들기 및 관리:
Cloud Filestore 편집자 (
roles/file.editor) -
Compute Engine 인스턴스 만들기 및 관리:
Compute 인스턴스 관리자 (v1) (
roles/compute.instanceAdmin.v1) -
Create a Compute Engine instance. Configure the instance as follows:
-
Name the instance
nfs-client. --zone플래그를us-central1-c로 설정합니다.--image-project플래그를debian-cloud로 설정합니다.--image-family플래그를debian-11로 설정합니다.-
--tags플래그를http-server,로 설정합니다.
gcloud compute instances create nfs-client --zone=us-central1-c --image-project=debian-cloud --image-family=debian-11 --tags=http-server,
-
Name the instance
-
Create a Compute Engine instance. Configure the instance as follows:
-
Name the instance
nfs-client. --zone플래그를us-central1-c로 설정합니다.--image-project플래그를windows-cloud로 설정합니다.--image-family플래그를windows-2012-r2로 설정합니다.-
--tags플래그를http-server,http-server,로 설정합니다.
gcloud compute instances create nfs-client --zone=us-central1-c --image-project=windows-cloud --image-family=windows-2012-r2 --tags=http-server,http-server,
-
Name the instance
IAM 인스턴스를 만듭니다. 다음과 같이 인스턴스를 구성합니다.
- 인스턴스 이름을
nfs-server로 지정합니다. --region플래그를us-central1로 설정합니다.--tier플래그를REGIONAL로 설정합니다.--performance플래그를max-iops-per-tb=17000로 설정합니다.--file-share플래그를name="vol1",capacity=1TB로 설정합니다.--network플래그를name="default"로 설정합니다.gcloud filestore instances create nfs-server --region=us-central1 --tier=REGIONAL --performance=max-iops-per-tb=17000 --file-share=name="vol1",capacity=1TB --network=name="default"
- 인스턴스 이름을
생성한 IAM 인스턴스에 대한 정보를 가져옵니다.
gcloud filestore instances describe nfs-server --region=us-central1
이 명령어는 다음과 비슷한 결과를 반환합니다.
createTime: '2025-02-12T09:15:08.163246004Z' customPerformanceSupported: true fileShares: -capacityGb: '1024' name: vol1 name: projects/yourproject/locations/us-central1/instances/nfs-server networks: -connectMode: DIRECT_PEERING ipAddresses: - 10.0.0.2 network: default reservedIpRange: 10.0.0.2/26 performanceConfig: iopsPerTb: maxIopsPerTb: '17000' performanceLimits: maxIops: '17000' maxReadIops: '17000' maxReadThroughputBps: '417792000' maxWriteIops: '5100' maxWriteThroughputBps: '139264000' protocol: NFS_V3 state: READY tier: REGIONAL
-
Establish an SSH connection to the
nfs-client인스턴스:gcloud compute ssh nfs-client
nfs-client의 터미널 창에서 다음 명령어를 실행하여 NFS를 설치합니다.sudo apt-get -y update && sudo apt-get -y install nfs-commonIAM 파일 공유에 대해
nfs-client인스턴스에 마운트 디렉터리를 만듭니다.sudo mkdir /mnt/testIAM 인스턴스의 IP 주소, 파일 공유 이름, 마운트할 마운트 디렉터리를 지정하여
mount명령어로nfs-client인스턴스에 파일 공유를 마운트합니다.sudo mount MOUNT-POINT-DIRECTORY /mnt/test각 항목의 의미는 다음과 같습니다.
MOUNT-POINT-DIRECTORY는 Filestore 파일 공유가 마운트된 디렉터리의 경로입니다. 예를 들면
10.0.0.2:/vol1입니다.선택사항: Filestore 파일 공유가 마운트되었는지 확인합니다.
df -h --type=nfs
파일 공유 액세스가 가능하도록 권한을 변경합니다.
sudo chmod go+rw /mnt/test계정을 만들고
nfs-client인스턴스에 대해 초기 비밀번호를 설정합니다.gcloud compute reset-windows-password nfs-client직렬 포트에 연결할 수 있도록 인스턴스를 구성합니다.
gcloud compute instances add-metadata nfs-client --metadata=serial-port-enable=1대화형 세션을 입력합니다.
gcloud compute connect-to-serial-port nfs-client --port=2SAC>프롬프트에서 새 채널을 만듭니다.cmd이름이
Cmd0001인 채널이 생성됩니다.채널에 연결합니다.
ch -sn Cmd0001nfs-client인스턴스의 사용자 이름과 비밀번호를 입력하고Domain필드를 비워 둡니다.nfs-client인스턴스의Command Prompt인터페이스에 연결됩니다.nfs-client의Command Prompt에서Windows PowerShell로 전환합니다.powershellNFS클라이언트를 설치합니다.Install-WindowsFeature -Name NFS-Client메시지가 표시되면
nfs-client인스턴스를 다시 시작합니다.restart-computerSAC>프롬프트에서 다음 알림이 표시될 때까지 기다립니다.EVENT: The CMD command is now available.
그런 후 이전 안내에 따라
cmd및ch -sn명령어를 실행하여 로그인하고nfs-client인스턴스에 다시 연결합니다.- 명령 프롬프트에서
powershell을 실행하여 Windows PowerShell로 전환합니다. PowerShell에서 다음 명령어를 실행하여 2개의 새 레지스트리 항목AnonymousUid및AnonymousGid를 만듭니다.New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" ` -Name "AnonymousUid" -Value "0" -PropertyType DWORD New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" ` -Name "AnonymousGid" -Value "0" -PropertyType DWORDNFS 클라이언트 서비스를 다시 시작합니다.
nfsadmin client stop nfsadmin client startPowerShell을 종료합니다.exitCommand Prompt에서 IAM 인스턴스의 IP 주소, 파일 공유 이름, 마운트할 드라이브 문자를 지정하여mount명령어로nfs-client인스턴스에 파일 공유를 마운트합니다.mount -o mtype=hard 10.0.0.2:/vol1 z:nfs-client터미널 창에서 다음 명령어를 실행하여 이름이testfile인 파일을 만듭니다.echo 'This is a test' > /mnt/test/testfile다음 명령어를 실행하고
testfile이 반환된 디렉터리 콘텐츠에 있는지 확인하여 파일이 생성되었는지 확인합니다.ls /mnt/testnfs-client인스턴스의 명령 프롬프트 창에서 이름이testfile인 파일을 만듭니다.echo 'This is a test' > Z:\testfile다음 명령어를 실행하여 파일이 생성되었는지 확인합니다.
dir Z:그리고
testfile이 반환된 디렉터리 콘텐츠에 있는지 확인합니다.- Identity and Access Management 개요를 읽고 IAM의 기본사항을 자세히 알아보세요.
- 인스턴스 만들기의 안내에 따라 직접 IAM 인스턴스를 설정합니다.
- 액세스 제어를 읽어 IAM 작업 및 인스턴스의 리소스에 대한 액세스를 제어하는 방법을 알아봅니다.
- Filestore 인스턴스로 또는 Filestore 인스턴스에서 데이터를 복사하는 방법을 알아보세요.
- Cloud Storage에서 Filestore로 대규모 데이터 세트를 전송하는 방법을 알아보세요.
필요한 역할
빠른 시작을 완료하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요.
역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.
커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.
이 문서에 설명된 태스크를 완료했으면 만든 리소스를 삭제하여 청구가 계속되는 것을 방지할 수 있습니다. 자세한 내용은 삭제를 참조하세요.
Compute Engine VM 만들기
Linux
Windows
IAM 인스턴스 만들기
이 빠른 시작에서는 맞춤 성능이 사용 설정된 리전 서비스 등급에서 인스턴스를 만드는 방법을 보여줍니다. 인스턴스 만들기에 대한 자세한 내용은 인스턴스 만들기를 참고하세요.
파일 공유를 마운트할 때 사용하기 위해 인스턴스의 IP 주소를 복사합니다. 이 빠른 시작에서는 IP 주소 10.0.0.2가 사용됩니다.
IAM 파일 공유를 nfs-client 인스턴스에 마운트
Linux
Windows
nfs-client 인스턴스에 로그인하고 관리자로 명령 프롬프트를 엽니다.
NFS 클라이언트 설치
NFS 클라이언트에 사용되는 사용자 ID 구성
vol1 파일 공유를 nfs-client 인스턴스에 매핑
마운트된 파일 공유에서 파일 만들기
Linux
Windows
삭제
이 페이지에서 사용한 리소스 비용이 Google Cloud 계정에 청구되지 않도록 하려면 리소스가 포함된 Google Cloud 프로젝트를 삭제하세요.
Google Cloud 프로젝트 삭제
Delete a Google Cloud project:
gcloud projects delete PROJECT_ID
IAM 인스턴스 삭제
nfs-server 인스턴스를 삭제합니다.
gcloud filestore instances delete nfs-server --zone=us-central1-c
Compute Engine 인스턴스 삭제
인스턴스를 삭제합니다.gcloud compute instances delete nfs-client