หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Redis Result Table

Updated on 2024-09-29 GMT+08:00

Function

DLI exports the output data of the Flink job to Redis. Redis is a storage system that supports multiple types of data structures such as key-value. It can be used in scenarios such as caching, event pub/sub, and high-speed queuing. Redis supports direct read/write of strings, hashes, lists, queues, and sets. Redis works with in-memory dataset and provides persistence. For more information about Redis, visit https://redis.io/.

Prerequisites

An enhanced datasource connection with Redis has been established, so that you can configure security group rules as required.

Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
create table dwsSink (
  attr_name attr_type 
  (',' attr_name attr_type)* 
  (','PRIMARY KEY (attr_name, ...) NOT ENFORCED)
)
with (
'connector.type' = 'redis',
  'connector.host' = '',
  'connector.port' = '',
  'connector.password' = '',
  'connector.table-name' = '',
  'connector.key-column' = ''
);

Parameters

Table 1 Parameter description

Parameter

Mandatory

Description

connector.type

Yes

Connector type. Set this parameter to redis.

connector.host

Yes

Redis connector address

connector.port

Yes

Redis connector port

connector.password

No

Redis authentication password

connector.deploy-mode

No

Redis deployment mode. The value can be standalone or cluster. The default value is standalone.

connector.table-name

No

Name of the table stored in the Redis. This parameter is mandatory in the Redis Hashmap storage pattern. In this pattern, data is stored to Redis in hashmaps. The hash key is ${table-name}:${ext-key}, and the field name is the column name.

NOTE:

Table storage pattern: connector.table-name and connector.key-column are used as Redis keys. For the Redis hash type, each key corresponds to a hashmap. A hash key is a field name of the source table, and a hash value is a field value of the source table.

connector.key-column

No

This parameter is optional in table storage pattern. The value is used as the value of ext-key in the Redis. If this parameter is not set, the value of ext-key is the generated UUID.

connector.write-schema

No

Whether to write the current schema to the Redis. This parameter is available in table storage pattern. The default value is false.

connector.data-type

No

Data types for storage. This parameter is mandatory for a custom storage pattern. Supported values include string, list, hash, and set. In a string, list or set, the number of schema fields must be 2, and the number of hash fields must be 3.

connector.ignore-retraction

No

Whether to ignore the retraction message. The default value is false.

Precautions

Either connector.table-name or connector.data-type must be set.

Example

  • Configure the table storage pattern when you configure connector.table-name.
    In table storage pattern, data is stored in hash mode, which is different from the basic hash pattern in which the three fields of a table are used as the key, hash_key, and hash_value. The key in table pattern can be specified by connector.table-name and connector.key-column parameters, all field names in the table are used as hash_key, and the field values are written to the hash table as hash_value.
    create table redisSink(
      car_id STRING,
      car_owner STRING,
      car_brand STRING,
      car_speed INT
    ) with (
      'connector.type' = 'redis',
      'connector.host' = 'xx.xx.xx.xx',
      'connector.port' = '6379',
      'connector.password' = 'xx',
      'connector.table-name'='car_info',
      'connector.key-column'='car_id'
    );
    
    insert into redisSink
      (car_id,car_owner,car_brand,car_speed)
      VALUES
      ("A1234","OwnA","A1234",30);
  • The following example shows how to create a table when connector.data-type is set to string, list, hash, or set, respectively.
    • String type
      The table contains two columns: key and value.
      create table redisSink(
        attr1 STRING,
        attr2 STRING
      ) with (
        'connector.type' = 'redis',
        'connector.host' = 'xx.xx.xx.xx',
        'connector.port' = '6379',
        'connector.password' = 'xx',
        'connector.data-type' = 'string'
      );
      
      insert into redisSink
        (attr1,attr2)
        VALUES
        ("car_id","A1234");
    • List type
      The table contains two columns: key and value.
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      13
      14
      15
      create table redisSink(
        attr1 STRING,
        attr2 STRING
      ) with (
        'connector.type' = 'redis',
        'connector.host' = 'xx.xx.xx.xx',
        'connector.port' = '6379',
        'connector.password' = 'xx',
        'connector.data-type' = 'list'
      );
      
      insert into redisSink
        (attr1,attr2)
        VALUES
        ("car_id","A1234");
      
    • Set type
      The table contains two columns: key and value.
      create table redisSink(
        attr1 STRING,
        attr2 STRING
      ) with (
        'connector.type' = 'redis',
        'connector.host' = 'xx.xx.xx.xx',
        'connector.port' = '6379',
        'connector.password' = 'xx',
        'connector.data-type' = 'set'
      );
      
      insert into redisSink
        (attr1,attr2)
        VALUES
        ("car_id","A1234");
    • Hash type
      The table contains three columns: key, hash_key, and hash_value.
      create table redisSink(
        attr1 STRING,
        attr2 STRING,
        attr3 STRING
      ) with (
        'connector.type' = 'redis',
        'connector.host' = 'xx.xx.xx.xx',
        'connector.port' = '6379',
        'connector.password' = 'xx',
        'connector.data-type' = 'hash'
      );
      
      insert into redisSink
        (attr1,attr2,attr3)
        VALUES
        ("car_info","car_id","A1234");

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback