forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
112 lines
10 KiB
HTML
112 lines
10 KiB
HTML
<a name="dli_08_0260"></a><a name="dli_08_0260"></a>
|
|
|
|
<h1 class="topictitle1">Creating a Redis Table</h1>
|
|
<div id="body1574393121907"><p id="dli_08_0260__p193831516255">Create a Redis table to connect to the source stream.</p>
|
|
<p id="dli_08_0260__p174595520164">For details about the JOIN syntax, see <a href="dli_08_0106.html">JOIN Between Stream Data and Table Data</a>.</p>
|
|
<div class="section" id="dli_08_0260__section1691193353316"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="dli_08_0260__screen1926112177583"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="n">table_id</span><span class="w"> </span><span class="p">(</span><span class="n">key_attr_name</span><span class="w"> </span><span class="n">STRING</span><span class="p">(,</span><span class="w"> </span><span class="n">hash_key_attr_name</span><span class="w"> </span><span class="n">STRING</span><span class="p">)</span><span class="o">?</span><span class="p">,</span><span class="w"> </span><span class="n">value_attr_name</span><span class="w"> </span><span class="n">STRING</span><span class="p">)</span>
|
|
<span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span>
|
|
<span class="w"> </span><span class="k">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">"dcs_redis"</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">cluster_address</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">""</span><span class="p">(,</span><span class="n">password</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ss">""</span><span class="p">)</span><span class="o">?</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">value_type</span><span class="o">=</span><span class="w"> </span><span class="ss">""</span><span class="p">,</span>
|
|
<span class="w"> </span><span class="n">key_column</span><span class="o">=</span><span class="w"> </span><span class="ss">""</span><span class="p">(,</span><span class="n">hash_key_column</span><span class="o">=</span><span class="ss">""</span><span class="p">)</span><span class="o">?</span><span class="p">);</span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0260__section1887775418596"><h4 class="sectiontitle">Keywords</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dli_08_0260__table115011952171611" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Keywords</caption><thead align="left"><tr id="dli_08_0260__row7534452171619"><th align="left" class="cellrowborder" valign="top" width="19%" id="mcps1.3.4.2.2.4.1.1"><p id="dli_08_0260__p145430522169">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="11.06060606060606%" id="mcps1.3.4.2.2.4.1.2"><p id="dli_08_0260__p955415216164">Mandatory</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="69.93939393939395%" id="mcps1.3.4.2.2.4.1.3"><p id="dli_08_0260__p1056555281615">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="dli_08_0260__row8575105261616"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p115829524168">type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p155921052121611">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p1760455216163">Output channel type. Value <strong id="dli_08_0260__en-us_topic_0111499977_b842352706193849">dcs_redis</strong> indicates that data is exported to DCS Redis.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row11645852191610"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p565885212162">cluster_address</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p6667135211168">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p96761523168">Redis instance connection address.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row166821052141616"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p1369325241618">password</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p1025374113382">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p1771225221618">Redis instance connection password. This parameter is not required if password-free access is used.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row1871675211610"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p1172525271610">value_type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p373355271615">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p2741185261620">Indicates the field data type. Supported data types include string, list, hash, set, and zset.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row177441952131614"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p175312526163">key_column</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p1276213526161">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p8771175210163">Indicates the column name of the Redis key attribute.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row69411319206"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p1295431182012">hash_key_column</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p14951331182014">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p1295631122016">If <strong id="dli_08_0260__b842352706172719">value_type</strong> is set to <strong id="dli_08_0260__b842352706172722">hash</strong>, this field must be specified as the column name of the level-2 key attribute.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row99341317165517"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p189351517175514">cache_max_num</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p1893516176555">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p29351617135515">Indicates the maximum number of cached query results. The default value is <strong id="dli_08_0260__b06661331101617">32768</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="dli_08_0260__row207942418558"><td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.4.2.2.4.1.1 "><p id="dli_08_0260__p1079162475510">cache_time</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="11.06060606060606%" headers="mcps1.3.4.2.2.4.1.2 "><p id="dli_08_0260__p1799247551">No</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="69.93939393939395%" headers="mcps1.3.4.2.2.4.1.3 "><p id="dli_08_0260__p179524185520">Indicates the maximum duration for caching database query results in the memory. The unit is millisecond. The default value is <strong id="dli_08_0260__b062293711613">10000</strong>. The value <strong id="dli_08_0260__b1762218376166">0</strong> indicates that caching is disabled.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="dli_08_0260__section52820018344"><h4 class="sectiontitle">Precautions</h4><ul id="dli_08_0260__ul13806261511"><li id="dli_08_0260__li1517006359">Redis clusters are not supported.</li><li id="dli_08_0260__li178061169113">Ensure that You have created a Redis cache instance on DCS using your account.</li><li id="dli_08_0260__en-us_topic_0111499975_li14111191212396">In this scenario, jobs must run on the dedicated queue of DLI. Therefore, DLI must interconnect with the enhanced datasource connection that has been connected with DCS instance. You can also set the security group rules as required.<p id="dli_08_0260__p94091618103916"><a name="dli_08_0260__en-us_topic_0111499975_li14111191212396"></a><a name="en-us_topic_0111499975_li14111191212396"></a>For details about how to create an enhanced datasource connection, see <span class="filepath" id="dli_08_0260__dli_08_0249_en-us_topic_0132966325_filepath13726182511815"><b>Enhanced Datasource Connections</b></span> in the <i><cite id="dli_08_0260__dli_08_0249_cite534516e564224b13bad1de4471da3139181527">Data Lake Insight User Guide</cite></i>.</p>
|
|
<p id="dli_08_0260__p20933178201815">For details about how to configure security group rules, see <span class="filepath" id="dli_08_0260__dli_08_0249_filepath78235157113"><b>Security Group</b></span> in the <em id="dli_08_0260__dli_08_0249_i082519153111">Virtual Private Cloud User Guide</em>.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="dli_08_0260__section13376151217347"><h4 class="sectiontitle">Example</h4><div class="p" id="dli_08_0260__p88543522162">The Redis table is used to connect to the source stream.<pre class="screen" id="dli_08_0260__screen68579527168">CREATE TABLE table_a (attr1 string, attr2 string, attr3 string)
|
|
WITH (
|
|
type = "dcs_redis",
|
|
value_type = "hash",
|
|
key_column = "attr1",
|
|
hash_key_column = "attr2",
|
|
cluster_address = "192.168.1.238:6379",
|
|
password = "xxxxxxxx"
|
|
);</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dli_08_0259.html">Creating a Dimension Table</a></div>
|
|
</div>
|
|
</div>
|
|
|