콘텐츠로 이동

제품정보

종합 HashiCorp Consul 명령 및 서비스 발견, 구성 관리 및 서비스 메쉬에 대한 워크플로우.

설치 및 설치

Command Description
consul version Show Consul version
consul agent -dev Start development agent
consul agent -config-dir=/etc/consul.d Start with configuration
consul members List cluster members
consul info Show agent information

에이전트 관리

Basic Agent 운영

Command Description
consul agent -server -bootstrap-expect=3 Start server agent
consul agent -client=0.0.0.0 Start client agent
consul join 192.168.1.100 Join cluster
consul leave Gracefully leave cluster
consul reload Reload configuration

Agent 구성

Command Description
consul validate /etc/consul.d Validate configuration
consul configtest Test configuration

서비스 Discovery

서비스 등록

Command Description
consul services register service.json Register service from file
consul services deregister service-id Deregister service
consul catalog services List all services
consul catalog nodes List all nodes

서비스 Queries

Command Description
consul catalog service web List instances of service
consul catalog service web -tag production Filter by tag
consul health service web Health check status
consul health node node1 Node health status

DNS 보호 제품 설명

Command Description
dig @127.0.0.1 -p 8600 web.service.consul Query service via DNS
dig @127.0.0.1 -p 8600 web.service.dc1.consul Query specific datacenter
dig @127.0.0.1 -p 8600 node1.node.consul Query node via DNS

Key-Value 스토어

KV 가동

Command Description
consul kv put config/database/url "postgresql://..." Store key-value
consul kv get config/database/url Retrieve value
consul kv get -recurse config/ Get all keys under prefix
consul kv delete config/database/url Delete key
consul kv delete -recurse config/ Delete all keys under prefix

KV 고급 작업

Command Description
consul kv put -cas -modify-index=123 config/app/version "2.0" Conditional update
consul kv get -detailed config/app/version Get with metadata
consul kv export config/ Export keys
consul kv import @backup.json Import keys

건강 검사

Health Check 관리

Command Description
consul health checks List all health checks
consul health checks web List checks for service
consul health state critical List critical checks
consul health state passing List passing checks

액세스 제어 목록 (ACLs)

ACL 관리

Command Description
consul acl bootstrap Bootstrap ACL system
consul acl token create -description="Web service token" Create token
consul acl token list List tokens
consul acl token delete TOKEN_ID Delete token

ACL 정책

Command Description
consul acl policy create -name web-policy -rules @policy.hcl Create policy
consul acl policy list List policies
consul acl policy read web-policy Read policy
consul acl policy update -id POLICY_ID -rules @new-policy.hcl Update policy

연결 (서비스 메쉬)

연결 구성

Command Description
consul connect ca get-config Get CA configuration
consul connect ca set-config -config-file ca.json Set CA configuration
consul connect proxy -service web Start Connect proxy

회사연혁

Command Description
consul intention create web db Allow web to connect to db
consul intention create -deny web cache Deny web to cache
consul intention list List all intentions
consul intention delete web db Delete intention

구성 항목

서비스 구성

Command Description
consul config write service-defaults.hcl Write service defaults
consul config write proxy-defaults.hcl Write proxy defaults
consul config list -kind service-defaults List configurations
consul config read -kind service-defaults -name web Read configuration
consul config delete -kind service-defaults -name web Delete configuration

Snapshots 및 백업

Snapshot 운영

Command Description
consul snapshot save backup.snap Create snapshot
consul snapshot restore backup.snap Restore snapshot
consul snapshot inspect backup.snap Inspect snapshot

모니터링 및 디버깅

모니터링 명령

Command Description
consul monitor Stream logs
consul monitor -log-level=DEBUG Debug level logs
consul debug Collect debug information
consul operator raft list-peers List Raft peers

- 연혁

Command Description
consul operator autopilot get-config Get autopilot config
consul operator autopilot set-config -cleanup-dead-servers=true Set autopilot config

구성 예제

Server 구성

카지노사이트

고객 구성

카지노사이트

서비스 정의

카지노사이트

ACL 정책

카지노사이트

서비스 메시 윤곽

프록시 기본값

카지노사이트

서비스 기본값

카지노사이트

다중 데이터 센터 설치하기

WAN 연맹

Command Description
consul join -wan 192.168.2.10 Join WAN
consul members -wan List WAN members
consul catalog datacenters List datacenters

크로스 DC 쿼리

Command Description
consul catalog service web -datacenter dc2 Query service in DC2
dig @127.0.0.1 -p 8600 web.service.dc2.consul DNS query to DC2

문제 해결

일반적인 문제

Command Description
consul operator raft list-peers Check Raft cluster state
consul debug -duration=30s Collect debug info
consul validate /etc/consul.d Validate configuration
consul members -detailed Detailed member information

로그 분석

Command Description
consul monitor -log-level=TRACE Trace level logging
journalctl -u consul -f Follow systemd logs

최고의 연습

계정 관리

  1. Enable ACLs: 항상 생산에 ACLs 사용
  2. **TLS 암호화 **: 모든 통신을 위한 Enable TLS
  3. Gossip Encryption: gossip 암호화 사용
  4. 명세 Network Segmentation: Proper 네트워크 보안
  5. 명세 ** 토큰 관리 **: 토큰을 정기적으로 회전

- 연혁

  1. ** 자원 할당 ** : CPU 및 메모리를 적절
  2. 네트워크 대기시간: 네트워크 대기시간 최소화
  3. ** 디스크 I/O **: 데이터 디렉토리에 대한 빠른 저장
  4. 명세 ** 클러스터 크기**: Optimal cluster sizing
  5. 명세 Monitoring: 종합 모니터링 설정

영업 시간

  1. ** 백업 전략 **: 일반 스냅샷
  2. ** 업그레이드 계획 **: 관리 업그레이드 절차
  3. ** 건강 감시 **: 감시 서비스 건강
  4. 명세 ** 수용량 계획 **: 성장 계획
  5. 명세 Documentation: 문서 서비스 topology

회사연혁

  1. ** 서비스 등록**: Proper 서비스 정의
  2. ** 건강 검사 **: 종합 건강 검사
  3. ** 구성 관리 **: KV 상점을 효과적으로 사용하십시오
  4. 명세 Service Discovery: 적절한 발견 패턴 구현
  5. 명세 테스트: 서비스 메쉬 구성 테스트