아파치 Cassandra 회사 소개¶
아파시 Cassandra - 분산 NoSQL 데이터베이스
Apache Cassandra는 무료 및 오픈 소스, 배포, 넓은 열 저장소, NoSQL 데이터베이스 관리 시스템 많은 필수 서버에서 대량의 데이터를 처리하도록 설계, 실패의 단일 지점과 높은 가용성을 제공.
본문 바로가기¶
- 설치
- 기본 명령
- Keyspace 운영
- 테이블 운영
- 데이터 타입
- CRUD 운영
- 작업
- 인덱스
- 사용자 정의 유형
- 기능
- 재료
- 배치 운영
- 지능 레벨
- 클러스터 관리
- 기능 조정
- 모니터링
- 보안
- 모범 사례
설치하기¶
Ubuntu/Debian 설치¶
카지노사이트
센트로/RHEL 설치하기¶
카지노사이트
Docker 설치¶
카지노사이트
수동 설치¶
카지노사이트
기본 명령¶
Cassandra에 연결¶
카지노사이트
사이트맵 쉘 명령¶
카지노사이트
시스템 정보¶
카지노사이트
Keyspace 운영¶
Keyspaces 만들기¶
카지노사이트
Keyspaces 관리¶
카지노사이트
테이블 작업¶
테이블 만들기¶
카지노사이트
수정 테이블¶
ο 회원 관리
표 정보¶
카지노사이트
데이터 유형¶
기본 데이터 유형¶
카지노사이트
수집 데이터 유형¶
카지노사이트
사용자 정의 유형¶
카지노사이트
프로젝트 영업 시간¶
삽입 작업¶
카지노사이트
연락처¶
카지노사이트
업데이트 작업¶
카지노사이트
작업 삭제¶
카지노사이트
Query 작업¶
고급 쿼리¶
오프화이트
관련 기능¶
카지노사이트
내장 기능¶
오프화이트
이름 *¶
두 번째 인덱스¶
카지노사이트
SASI 지수 (카사드라 3.4+)¶
카지노사이트
사용자 정의 유형¶
UDT를 만들고 관리¶
카지노사이트
제품정보¶
사용자 정의 기능 (UDF)¶
카지노사이트
사용자 정의 집합 (UDA)¶
카지노사이트
자료 처리 이름 *¶
Materialized 만들기 이름 *¶
카지노사이트
자료 처리 고려사항¶
```cql -- Materialized views are automatically maintained -- Base table changes are propagated to views
-- Insert into base table INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'new_user', 'new@example.com', 'New', 'User', toTimestamp(now()));
-- Query view to see automatic update SELECT * FROM users_by_email WHERE email = 'new@example.com';
-- Update base table UPDATE users SET first_name = 'Updated' WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
-- View is automatically updated SELECT * FROM users_by_email WHERE email = 'john@example.com';
-- Show all materialized views SELECT keyspace_name, view_name, base_table_name FROM system_schema.views; ```의 경우
일괄 작업¶
일괄 선언¶
```cql -- Logged batch (default) BEGIN BATCH INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'batch_user1', 'batch1@example.com', 'Batch', 'User1', toTimestamp(now()));
INSERT INTO users (user_id, username, email, first_name, last_name, created_at)
VALUES (uuid(), 'batch_user2', 'batch2@example.com', 'Batch', 'User2', toTimestamp(now()));
UPDATE users SET email = 'updated@example.com'
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
APPLY BATCH;
-- Unlogged batch (better performance, no atomicity guarantee) BEGIN UNLOGGED BATCH INSERT INTO user_posts (user_id, post_id, title, content, created_at) VALUES (123e4567-e89b-12d3-a456-426614174000, now(), 'Post 1', 'Content 1', toTimestamp(now()));
INSERT INTO user_posts (user_id, post_id, title, content, created_at)
VALUES (123e4567-e89b-12d3-a456-426614174000, now(), 'Post 2', 'Content 2', toTimestamp(now()));
APPLY BATCH;
-- Batch with TTL and timestamp BEGIN BATCH USING TTL 3600 AND TIMESTAMP 1640995200000000 INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'temp_user', 'temp@example.com', 'Temp', 'User', toTimestamp(now()));
UPDATE users SET phone = '+1-555-9999'
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
APPLY BATCH;
-- Conditional batch BEGIN BATCH INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'conditional_user', 'conditional@example.com', 'Conditional', 'User', toTimestamp(now())) IF NOT EXISTS;
UPDATE users SET email = 'conditional_update@example.com'
WHERE user_id = 123e4567-e89b-12d3-a456-426614174000
IF email = 'old@example.com';
APPLY BATCH;
-- Counter batch BEGIN COUNTER BATCH UPDATE page_views SET views = views + 1 WHERE page_id = 'home'; UPDATE page_views SET views = views + 1 WHERE page_id = 'about'; APPLY BATCH; ```에 대하여
일관성 수준¶
일관된 수준 설정¶
```cql -- Show current consistency level CONSISTENCY;
-- Set consistency level for reads CONSISTENCY ONE; CONSISTENCY QUORUM; CONSISTENCY ALL; CONSISTENCY LOCAL_QUORUM; CONSISTENCY EACH_QUORUM; CONSISTENCY LOCAL_ONE;
-- Set consistency level for writes CONSISTENCY ONE; CONSISTENCY QUORUM; CONSISTENCY ALL; CONSISTENCY LOCAL_QUORUM; CONSISTENCY EACH_QUORUM;
-- Consistency levels explanation: -- ONE: One replica responds -- QUORUM: Majority of replicas respond -- ALL: All replicas respond -- LOCAL_QUORUM: Majority of replicas in local datacenter -- EACH_QUORUM: Majority of replicas in each datacenter -- LOCAL_ONE: One replica in local datacenter
-- Example queries with different consistency levels CONSISTENCY QUORUM; SELECT * FROM users WHERE user_id = 123e4567-e89b-12d3-a456-426614174000;
CONSISTENCY LOCAL_QUORUM; INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'consistent_user', 'consistent@example.com', 'Consistent', 'User', toTimestamp(now()));
-- Serial consistency for lightweight transactions SERIAL CONSISTENCY SERIAL; SERIAL CONSISTENCY LOCAL_SERIAL;
-- Lightweight transaction with serial consistency INSERT INTO users (user_id, username, email, first_name, last_name, created_at) VALUES (uuid(), 'lwt_user', 'lwt@example.com', 'LWT', 'User', toTimestamp(now())) IF NOT EXISTS; ```의 경우
Cluster 관리¶
Node 운영¶
```bash
Check cluster status¶
nodetool status
Check node information¶
nodetool info
Check ring information¶
nodetool ring
Describe cluster¶
nodetool describecluster
Check gossip information¶
nodetool gossipinfo
Flush memtables to disk¶
nodetool flush
Compact SSTables¶
nodetool compact
Cleanup after replication changes¶
nodetool cleanup
Repair data¶
nodetool repair
Repair specific keyspace¶
nodetool repair mykeyspace
Repair specific table¶
nodetool repair mykeyspace mytable
Incremental repair¶
nodetool repair -inc
Full repair¶
nodetool repair -full ```에 대하여
Cluster 모니터링¶
```bash
Check node stats¶
nodetool netstats
Check compaction stats¶
nodetool compactionstats
Check thread pool stats¶
nodetool tpstats
Check histogram stats¶
nodetool cfstats
Check table stats¶
nodetool tablestats mykeyspace.mytable
Check proxyhistograms¶
nodetool proxyhistograms
Check gossip state¶
nodetool gossipinfo
Check schema version¶
nodetool describecluster
Check pending tasks¶
nodetool pendingcompactions
Check streaming operations¶
nodetool netstats ```의 경우
백업 및 Snapshot¶
카지노사이트
추가/제거 노드¶
카지노사이트
성능 조정¶
Query 최적화¶
카지노사이트
테이블 디자인 Optimization¶
카지노사이트
성능 모니터링¶
카지노사이트
관련 기사¶
시스템 모니터링¶
카지노사이트
사이트맵 관련 기사¶
```bash
Enable JMX (in cassandra-env.sh)¶
JVM_OPTS="\(JVM_OPTS -Dcom.sun.management.jmxremote" JVM_OPTS="\)JVM_OPTS -Dcom.sun.management.jmxremote.port=7199" JVM_OPTS="\(JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=7199" JVM_OPTS="\)JVM_OPTS -Dcom.sun.management.jmxremote.ssl=false" JVM_OPTS="$JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
Connect with JConsole¶
jconsole localhost:7199
Key JMX metrics to monitor:¶
- org.apache.cassandra.metrics:type=ClientRequest,scope=Read,name=Latency¶
- org.apache.cassandra.metrics:type=ClientRequest,scope=Write,name=Latency¶
- org.apache.cassandra.metrics:type=Storage,name=Load¶
- org.apache.cassandra.metrics:type=Compaction,name=PendingTasks¶
- java.lang:type=Memory¶
- java.lang:type=GarbageCollector¶
```의 경우
로그 모니터링¶
```bash
System log location¶
tail -f /var/log/cassandra/system.log
Debug log¶
tail -f /var/log/cassandra/debug.log
GC log¶
tail -f /var/log/cassandra/gc.log
Key log patterns to monitor:¶
- "OutOfMemoryError"¶
- "Dropping mutation"¶
- "Timeout"¶
- "Unable to gossip"¶
- "Compaction interrupted"¶
Configure log levels (logback.xml)¶
DEBUG, INFO, WARN, ERROR¶
Monitor specific packages¶
¶
¶
```의 경우
Application 모니터링¶
카지노사이트
계정 관리¶
인증현황¶
```cql -- Enable authentication (in cassandra.yaml) -- authenticator: PasswordAuthenticator
-- Create superuser (default: cassandra/cassandra) -- Change default password ALTER USER cassandra WITH PASSWORD 'new_secure_password';
-- Create new user CREATE USER app_user WITH PASSWORD 'secure_password' NOSUPERUSER;
-- Create superuser CREATE USER admin_user WITH PASSWORD 'admin_password' SUPERUSER;
-- Alter user password ALTER USER app_user WITH PASSWORD 'new_password';
-- List users LIST USERS;
-- Drop user DROP USER app_user; ```의 경우
이름 *¶
```cql -- Enable authorization (in cassandra.yaml) -- authorizer: CassandraAuthorizer
-- Grant permissions GRANT SELECT ON KEYSPACE mykeyspace TO app_user; GRANT MODIFY ON KEYSPACE mykeyspace TO app_user; GRANT CREATE ON KEYSPACE mykeyspace TO app_user; GRANT DROP ON KEYSPACE mykeyspace TO app_user; GRANT ALTER ON KEYSPACE mykeyspace TO app_user;
-- Grant table-level permissions GRANT SELECT ON mykeyspace.users TO app_user; GRANT MODIFY ON mykeyspace.users TO app_user;
-- Grant all permissions GRANT ALL PERMISSIONS ON KEYSPACE mykeyspace TO app_user;
-- Revoke permissions REVOKE SELECT ON KEYSPACE mykeyspace FROM app_user;
-- List permissions LIST ALL PERMISSIONS; LIST ALL PERMISSIONS OF app_user;
-- Create role (Cassandra 2.2+) CREATE ROLE app_role;
-- Grant role to user GRANT app_role TO app_user;
-- Grant permissions to role GRANT SELECT ON KEYSPACE mykeyspace TO app_role;
-- List roles LIST ROLES; ```를 호출합니다.
SSL/TLS 암호화¶
```yaml
Client-to-node encryption (in cassandra.yaml)¶
client_encryption_options: enabled: true optional: false keystore: /path/to/keystore.jks keystore_password: keystore_password truststore: /path/to/truststore.jks truststore_password: truststore_password protocol: TLS algorithm: SunX509 store_type: JKS cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA]
Node-to-node encryption¶
server_encryption_options: internode_encryption: all keystore: /path/to/keystore.jks keystore_password: keystore_password truststore: /path/to/truststore.jks truststore_password: truststore_password protocol: TLS algorithm: SunX509 store_type: JKS cipher_suites: [TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA] ```의 경우
네트워크 보안¶
```yaml
Configure listen addresses (in cassandra.yaml)¶
listen_address: 10.0.0.1 rpc_address: 10.0.0.1 broadcast_address: 10.0.0.1 broadcast_rpc_address: 10.0.0.1
Configure ports¶
storage_port: 7000 ssl_storage_port: 7001 native_transport_port: 9042 rpc_port: 9160
Enable native protocol SSL¶
native_transport_port_ssl: 9142
Firewall rules (example for iptables)¶
Allow Cassandra ports from cluster nodes only¶
iptables -A INPUT -p tcp --dport 7000 -s 10.0.0.0/24 -j ACCEPT¶
iptables -A INPUT -p tcp --dport 7001 -s 10.0.0.0/24 -j ACCEPT¶
iptables -A INPUT -p tcp --dport 9042 -s 10.0.0.0/24 -j ACCEPT¶
```로
최고의 연습¶
데이터 모델링 최고의 연습¶
카지노사이트
Query 모범 사례¶
오프화이트
성과 모범 사례¶
카지노사이트
운영 모범 사례¶
__CODE_BLOCK_49_로그
개발 모범 사례¶
카지노사이트
제품정보¶
Apache Cassandra는 대용량의 데이터를 처리하기 위해 설계된 매우 확장 가능한 배포 NoSQL 데이터베이스입니다. 이 cheatsheet는 기본 관리에서 고급 기능에 Cassandra 작업의 포괄적 인 범위를 제공합니다.
** 키 강도:** - Scalability: 단 하나 실패를 가진 선형 확장성 - High Availability: tunable 견실함을 가진 다 자료 센터 복제 - Performance: 빠른 읽기를 가진 쓰기 heavy workloads를 위해 낙관하는 - ** 결함 포용력 **: 자동적인 자료 복제 및 실패 탐지 - ** 유연한 데이터 모델 **: 각종 자료 유형을 지원하는 넓은 란 상점
** 최고의 사용 사례:** - 시간 시리즈 데이터 및 IoT 응용 - 실시간 분석 및 로깅 - 콘텐츠 관리 및 카탈로그 - 메시징 및 소셜 미디어 플랫폼 - 높은 쓰기 처리량을 요구하는 신청
** 중요 고려 사항 : ** - 데이터 모델링은 쿼리 우선 접근 방식을 요구합니다. - 복잡한 쿼리에 대한 제한적 지원 및 가입 - Eventual 견실함 모형은 주의깊게 고려해야 합니다 - 작동 복잡성 클러스터 크기 증가 - 분산 시스템 개념의 이해
이 속임수 시트에 명시된 관행과 기법을 따라 효과적으로 설계, 구현 및 현대 분산 응용 프로그램에 대한 고성능, 확장성 및 가용성을 제공하는 Cassandra 데이터베이스를 유지할 수 있습니다.
<문서> 기능 copyToClipboard () 이름 * const 명령어 = document.querySelectorAll('code'); let allCommands = ''; 명령. forEach(cmd =>의 경우 모든Commands +=cmd.textContent + navigator.clipboard.write텍스(allCommands); alert('모든 명령은 클립보드에 복사!'); 이름 *
함수 생성PDF() { 창. 인쇄 (); 이름 *