<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=5">
    <title>redis常用命令详解大数据 | 云图网</title>
    <meta name="keywords" content="分布式文件系统，分布式数据库,并行处理（MPP）数据库，数据挖掘,开源大数据平台,数据中台,数据分析,数据开发,数据治理,数据湖,数据采集">
<meta name="description" content="常用命令 &nbsp;&nbsp;&nbsp;&nbsp;1）连接操作命令&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;quit：关闭连接（connection）&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;auth：简单密码认证&nbsp; &nbsp;&nbsp;&nbsp;&amp;nbs…">
<meta property="og:type" content="article">
<meta property="og:url" content="https://blog.ytso.com/tech/bigdata/7668.html">
<meta property="og:site_name" content="云图网">
<meta property="og:title" content="redis常用命令详解大数据">
<meta property="og:description" content="常用命令 &nbsp;&nbsp;&nbsp;&nbsp;1）连接操作命令&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;quit：关闭连接（connection）&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;auth：简单密码认证&nbsp; &nbsp;&nbsp;&nbsp;&amp;nbs…">
<link rel="canonical" href="https://blog.ytso.com/tech/bigdata/7668.html">
<meta name="applicable-device" content="pc,mobile">
<meta http-equiv="Cache-Control" content="no-transform">
<link rel="shortcut icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg">
<link rel='dns-prefetch' href='//cdnjs.cloudflare.com' />
<style id='wp-img-auto-sizes-contain-inline-css' type='text/css'>
img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px}
/*# sourceURL=wp-img-auto-sizes-contain-inline-css */
</style>
<link rel='stylesheet' id='stylesheet-css' href='https://blog.ytso.com/wp-content/themes/justnews/css/style.css?ver=6.21.5' type='text/css' media='all' />
<link rel='stylesheet' id='material-icons-css' href='https://blog.ytso.com/wp-content/themes/justnews/themer/assets/css/material-icons.css?ver=6.21.5' type='text/css' media='all' />
<link rel='stylesheet' id='remixicon-css' href='https://cdnjs.cloudflare.com/ajax/libs/remixicon/4.2.0/remixicon.min.css?ver=6.9.4' type='text/css' media='all' />
<link rel='stylesheet' id='font-awesome-css' href='https://blog.ytso.com/wp-content/themes/justnews/themer/assets/css/font-awesome.css?ver=6.21.5' type='text/css' media='all' />
<style id='wp-block-library-inline-css' type='text/css'>
:root{--wp-block-synced-color:#7a00df;--wp-block-synced-color--rgb:122,0,223;--wp-bound-block-color:var(--wp-block-synced-color);--wp-editor-canvas-background:#ddd;--wp-admin-theme-color:#007cba;--wp-admin-theme-color--rgb:0,124,186;--wp-admin-theme-color-darker-10:#006ba1;--wp-admin-theme-color-darker-10--rgb:0,107,160.5;--wp-admin-theme-color-darker-20:#005a87;--wp-admin-theme-color-darker-20--rgb:0,90,135;--wp-admin-border-width-focus:2px}@media (min-resolution:192dpi){:root{--wp-admin-border-width-focus:1.5px}}.wp-element-button{cursor:pointer}:root .has-very-light-gray-background-color{background-color:#eee}:root .has-very-dark-gray-background-color{background-color:#313131}:root .has-very-light-gray-color{color:#eee}:root .has-very-dark-gray-color{color:#313131}:root .has-vivid-green-cyan-to-vivid-cyan-blue-gradient-background{background:linear-gradient(135deg,#00d084,#0693e3)}:root .has-purple-crush-gradient-background{background:linear-gradient(135deg,#34e2e4,#4721fb 50%,#ab1dfe)}:root .has-hazy-dawn-gradient-background{background:linear-gradient(135deg,#faaca8,#dad0ec)}:root .has-subdued-olive-gradient-background{background:linear-gradient(135deg,#fafae1,#67a671)}:root .has-atomic-cream-gradient-background{background:linear-gradient(135deg,#fdd79a,#004a59)}:root .has-nightshade-gradient-background{background:linear-gradient(135deg,#330968,#31cdcf)}:root .has-midnight-gradient-background{background:linear-gradient(135deg,#020381,#2874fc)}:root{--wp--preset--font-size--normal:16px;--wp--preset--font-size--huge:42px}.has-regular-font-size{font-size:1em}.has-larger-font-size{font-size:2.625em}.has-normal-font-size{font-size:var(--wp--preset--font-size--normal)}.has-huge-font-size{font-size:var(--wp--preset--font-size--huge)}.has-text-align-center{text-align:center}.has-text-align-left{text-align:left}.has-text-align-right{text-align:right}.has-fit-text{white-space:nowrap!important}#end-resizable-editor-section{display:none}.aligncenter{clear:both}.items-justified-left{justify-content:flex-start}.items-justified-center{justify-content:center}.items-justified-right{justify-content:flex-end}.items-justified-space-between{justify-content:space-between}.screen-reader-text{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-wrap:normal!important}.screen-reader-text:focus{background-color:#ddd;clip-path:none;color:#444;display:block;font-size:1em;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}html :where(.has-border-color){border-style:solid}html :where([style*=border-top-color]){border-top-style:solid}html :where([style*=border-right-color]){border-right-style:solid}html :where([style*=border-bottom-color]){border-bottom-style:solid}html :where([style*=border-left-color]){border-left-style:solid}html :where([style*=border-width]){border-style:solid}html :where([style*=border-top-width]){border-top-style:solid}html :where([style*=border-right-width]){border-right-style:solid}html :where([style*=border-bottom-width]){border-bottom-style:solid}html :where([style*=border-left-width]){border-left-style:solid}html :where(img[class*=wp-image-]){height:auto;max-width:100%}:where(figure){margin:0 0 1em}html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:var(--wp-admin--admin-bar--height,0px)}@media screen and (max-width:600px){html :where(.is-position-sticky){--wp-admin--admin-bar--position-offset:0px}}
/*wp_block_styles_on_demand_placeholder:69c8f3bc49ff9*/
/*# sourceURL=wp-block-library-inline-css */
</style>
<style id='classic-theme-styles-inline-css' type='text/css'>
/*! This file is auto-generated */
.wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none}
/*# sourceURL=/wp-includes/css/classic-themes.min.css */
</style>
<link rel='stylesheet' id='wpcom-member-css' href='https://blog.ytso.com/wp-content/plugins/wpcom-member/css/style.css?ver=1.7.19' type='text/css' media='all' />
<script type="text/javascript" src="https://blog.ytso.com/wp-includes/js/jquery/jquery.min.js?ver=3.7.1" id="jquery-core-js"></script>
<script type="text/javascript" src="https://blog.ytso.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.4.1" id="jquery-migrate-js"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="https://blog.ytso.com/xmlrpc.php?rsd" />
<meta name='description' content='常用命令 &nbsp;&nbsp;&nbsp;&nbsp;1）连接操作命令&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;quit：关闭连接（connection）&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;auth：简单密码认证&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;help&nbsp;cm…' />
<meta name='keywords' content='分布式文件系统，分布式数据库,并行处理（MPP）数据库，数据挖掘,开源大数据平台,数据中台,数据分析,数据开发,数据治理,数据湖,数据采集' />
<style>:root{--theme-color: #08c; --theme-hover: #07c; --logo-height: 32px; --logo-height-mobile: 26px; --menu-item-gap: 28px; --member-login-bg: url('https://blog.ytso.com/loginwall.jpg'); --header-bg-color: #fff; --header-bg-image: none; --theme-border-radius-s: 3px; --theme-border-radius-m: 5px; --theme-border-radius-l: 8px; --theme-border-radius-xl: 12px; --thumb-ratio-default: 480 / 300; --thumb-ratio-post: 480 / 300; --post-video-ratio: 860 / 482;}</style>
<link rel="icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" sizes="32x32" />
<link rel="icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" sizes="192x192" />
<link rel="apple-touch-icon" href="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" />
<meta name="msapplication-TileImage" content="https://imgcdn.ytso.com/wp-content/uploads/2024/10/20241015181503433.jpg" />
    <!--[if lte IE 11]><script src="https://blog.ytso.com/wp-content/themes/justnews/js/update.js"></script><![endif]-->
</head>
<body class="wp-singular post-template-default single single-post postid-7668 single-format-standard wp-theme-justnews lang-cn el-boxed header-fixed">
<header class="header header-fluid">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse" aria-label="menu">
                <span class="icon-bar icon-bar-1"></span>
                <span class="icon-bar icon-bar-2"></span>
                <span class="icon-bar icon-bar-3"></span>
            </button>
                        <div class="logo">
                <a href="https://blog.ytso.com/" rel="home">
                    <img src="https://imgcdn.ytso.com/wp-content/uploads/2021/12/20211207181156143.png" alt="云图网">
                </a>
            </div>
        </div>
        <div class="collapse navbar-collapse mobile-style-0">
            <nav class="primary-menu"><ul id="menu-justnews-footer-menu" class="nav navbar-nav wpcom-adv-menu"><li class="menu-item"><a href="https://blog.ytso.com/category/industrynews">业界资讯</a></li>
<li class="menu-item current-post-ancestor active menu-item-style menu-item-style-1 dropdown"><a target="_blank" href="https://blog.ytso.com/category/tech" class="dropdown-toggle">技术专区</a>
<ul class="dropdown-menu menu-item-wrap menu-item-col-5">
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/cloud">云计算</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/ai">人工智能</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/safety">信息安全</a></li>
	<li class="menu-item current-post-ancestor current-post-parent active"><a href="https://blog.ytso.com/category/tech/bigdata">大数据</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/dev">研发管理</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/webdev">大前端</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/opensource">开源</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/aiops">智能运维</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/pnotes">编程笔记</a></li>
	<li class="menu-item"><a href="https://blog.ytso.com/category/tech/wp">WordPress</a></li>
</ul>
</li>
<li class="menu-item"><a href="https://blog.ytso.com/category/enterprise-strategic-planning">企业战略规划</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/download">下载专区</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/it%e6%b1%9f%e6%b9%96%e5%8f%b2">江湖史</a></li>
<li class="menu-item"><a href="https://blog.ytso.com/category/notes">随笔记录</a></li>
</ul></nav>            <div class="navbar-action">
                <div class="navbar-search-icon j-navbar-search"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-search"></use></svg></i></div><form class="navbar-search" action="https://blog.ytso.com/" method="get" role="search"><div class="navbar-search-inner"><i class="wpcom-icon wi navbar-search-close"><svg aria-hidden="true"><use xlink:href="#wi-close"></use></svg></i><input type="text" name="s" class="navbar-search-input" autocomplete="off" maxlength="100" placeholder="输入关键词搜索..." value=""><button class="navbar-search-btn" type="submit" aria-label="搜索"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-search"></use></svg></i></button></div></form>                    <div id="j-user-wrap">
                        <a class="login" href="https://blog.ytso.com/login">登录</a>
                        <a class="login register" href="https://blog.ytso.com/register">注册</a>
                    </div>
                                            <a class="wpcom-btn btn-primary btn-xs publish" href="https://blog.ytso.com/contribute">
                            <i class="fa fa-edit"></i> 投稿                        </a>
                                </div>
        </div>
    </div><!-- /.container -->
</header>

<div id="wrap">    <div class="wrap container">
        <ol class="breadcrumb" vocab="https://schema.org/" typeof="BreadcrumbList"><li class="home" property="itemListElement" typeof="ListItem"><a href="https://blog.ytso.com" property="item" typeof="WebPage"><span property="name" class="hide">云图网</span>首页</a><meta property="position" content="1"></li><li property="itemListElement" typeof="ListItem"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-3"></use></svg></i><a href="https://blog.ytso.com/category/tech" property="item" typeof="WebPage"><span property="name">技术专区</span></a><meta property="position" content="2"></li><li property="itemListElement" typeof="ListItem"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-3"></use></svg></i><a href="https://blog.ytso.com/category/tech/bigdata" property="item" typeof="WebPage"><span property="name">大数据</span></a><meta property="position" content="3"></li></ol>        <main class="main">
                            <article id="post-7668" class="post-7668 post type-post status-publish format-standard hentry category-bigdata tag-117 tag-mpp tag-121 tag-125 tag-119 tag-120 tag-123 tag-124 tag-122 entry">
                    <div class="entry-main">
                                                                        <div class="entry-head">
                            <h1 class="entry-title">redis常用命令详解大数据</h1>
                            <div class="entry-info">
                                                                <time class="entry-date published" datetime="2021-07-18T22:09:06+08:00" pubdate>
                                    2021年7月18日 22:09                                </time>
                                <span class="dot">•</span>
                                <a href="https://blog.ytso.com/category/tech/bigdata" rel="category tag">大数据</a>                                                            </div>
                        </div>
                        
                                                <div class="entry-content text-indent text-justify">
                            <p>常用命令<br /></p>
<pre class="prism-language-fsharp">&nbsp;&nbsp;&nbsp;&nbsp;1）连接操作命令&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;quit：关闭连接（connection）&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;auth：简单密码认证&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;help&nbsp;cmd：&nbsp;查看cmd帮助，例如：help&nbsp;quit&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;2）持久化&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;save：将数据同步保存到磁盘&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;bgsave：将数据异步保存到磁盘&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lastsave：返回上次成功将数据保存到磁盘的Unix时戳&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;shundown：将数据同步保存到磁盘，然后关闭服务&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;3）远程服务控制&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;info：提供服务器的信息和统计&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;monitor：实时转储收到的请求&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;slaveof：改变复制策略设置&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;config：在运行时配置Redis服务器&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;4）对value操作的命令&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;exists(key)：确认一个key是否存在&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;del(key)：删除一个key&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;type(key)：返回值的类型&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;keys(pattern)：返回满足给定pattern的所有key&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;randomkey：随机返回key空间的一个&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;keyrename(oldname,&nbsp;newname)：重命名key&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;dbsize：返回当前数据库中key的数目&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;expire：设定一个key的活动时间（s）&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;ttl：获得一个key的活动时间&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;select(index)：按索引查询&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;move(key,&nbsp;dbindex)：移动当前数据库中的key到dbindex数据库&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;flushdb：删除当前选择数据库中的所有key&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;flushall：删除所有数据库中的所有key&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;5）String&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;set(key,&nbsp;value)：给数据库中名称为key的string赋予值value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;get(key)：返回数据库中名称为key的string的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;getset(key,&nbsp;value)：给名称为key的string赋予上一次的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;mget(key1,&nbsp;key2,…,&nbsp;key&nbsp;N)：返回库中多个string的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;setnx(key,&nbsp;value)：添加string，名称为key，值为value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;setex(key,&nbsp;time,&nbsp;value)：向库中添加string，设定过期时间time&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;mset(key&nbsp;N,&nbsp;value&nbsp;N)：批量设置多个string的值&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;msetnx(key&nbsp;N,&nbsp;value&nbsp;N)：如果所有名称为key&nbsp;i的string都不存在&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;incr(key)：名称为key的string增1操作&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;incrby(key,&nbsp;integer)：名称为key的string增加integer&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;decr(key)：名称为key的string减1操作&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;decrby(key,&nbsp;integer)：名称为key的string减少integer&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;append(key,&nbsp;value)：名称为key的string的值附加value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;substr(key,&nbsp;start,&nbsp;end)：返回名称为key的string的value的子串&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;6）List&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;rpush(key,&nbsp;value)：在名称为key的list尾添加一个值为value的元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lpush(key,&nbsp;value)：在名称为key的list头添加一个值为value的&nbsp;元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;llen(key)：返回名称为key的list的长度&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lrange(key,&nbsp;start,&nbsp;end)：返回名称为key的list中start至end之间的元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;ltrim(key,&nbsp;start,&nbsp;end)：截取名称为key的list&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lindex(key,&nbsp;index)：返回名称为key的list中index位置的元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lset(key,&nbsp;index,&nbsp;value)：给名称为key的list中index位置的元素赋值&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lrem(key,&nbsp;count,&nbsp;value)：删除count个key的list中值为value的元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;lpop(key)：返回并删除名称为key的list中的首元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;rpop(key)：返回并删除名称为key的list中的尾元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;blpop(key1,&nbsp;key2,…&nbsp;key&nbsp;N,&nbsp;timeout)：lpop命令的block版本。&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;brpop(key1,&nbsp;key2,…&nbsp;key&nbsp;N,&nbsp;timeout)：rpop的block版本。&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;rpoplpush(srckey,&nbsp;dstkey)：返回并删除名称为srckey的list的尾元素，&nbsp;
并将该元素添加到名称为dstkey的list的头部&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;7）Set&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sadd(key,&nbsp;member)：向名称为key的set中添加元素member&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;srem(key,&nbsp;member)&nbsp;：删除名称为key的set中的元素member&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;spop(key)&nbsp;：随机返回并删除名称为key的set中一个元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;smove(srckey,&nbsp;dstkey,&nbsp;member)&nbsp;：移到集合元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;scard(key)&nbsp;：返回名称为key的set的基数&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sismember(key,&nbsp;member)&nbsp;：member是否是名称为key的set的元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sinter(key1,&nbsp;key2,…key&nbsp;N)&nbsp;：求交集&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sinterstore(dstkey,&nbsp;(keys))&nbsp;：求交集并将交集保存到dstkey的集合&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sunion(key1,&nbsp;(keys))&nbsp;：求并集&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sunionstore(dstkey,&nbsp;(keys))&nbsp;：求并集并将并集保存到dstkey的集合&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sdiff(key1,&nbsp;(keys))&nbsp;：求差集&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;sdiffstore(dstkey,&nbsp;(keys))&nbsp;：求差集并将差集保存到dstkey的集合&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;smembers(key)&nbsp;：返回名称为key的set的所有元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;srandmember(key)&nbsp;：随机返回名称为key的set的一个元素&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;8）Hash&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hset(key,&nbsp;field,&nbsp;value)：向名称为key的hash中添加元素field&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hget(key,&nbsp;field)：返回名称为key的hash中field对应的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hmget(key,&nbsp;(fields))：返回名称为key的hash中field&nbsp;i对应的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hmset(key,&nbsp;(fields))：向名称为key的hash中添加元素field&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hincrby(key,&nbsp;field,&nbsp;integer)：将名称为key的hash中field的value增加integer&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hexists(key,&nbsp;field)：名称为key的hash中是否存在键为field的域&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hdel(key,&nbsp;field)：删除名称为key的hash中键为field的域&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hlen(key)：返回名称为key的hash中元素个数&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hkeys(key)：返回名称为key的hash中所有键&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hvals(key)：返回名称为key的hash中所有键对应的value&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;hgetall(key)：返回名称为key的hash中所有的键（field）及其对应的value</pre>
<p></p>
<div class="entry-readmore"><div class="entry-readmore-btn"></div></div>                                                        <div class="entry-copyright"><p>原创文章，作者：ItWorker，如若转载，请注明出处：https://blog.ytso.com/tech/bigdata/7668.html</p></div>                        </div>

                        <div class="entry-tag"><a href="https://blog.ytso.com/tag/%e5%88%86%e5%b8%83%e5%bc%8f%e6%96%87%e4%bb%b6%e7%b3%bb%e7%bb%9f%ef%bc%8c%e5%88%86%e5%b8%83%e5%bc%8f%e6%95%b0%e6%8d%ae%e5%ba%93" rel="tag">分布式文件系统，分布式数据库</a><a href="https://blog.ytso.com/tag/%e5%b9%b6%e8%a1%8c%e5%a4%84%e7%90%86%ef%bc%88mpp%ef%bc%89%e6%95%b0%e6%8d%ae%e5%ba%93%ef%bc%8c%e6%95%b0%e6%8d%ae%e6%8c%96%e6%8e%98" rel="tag">并行处理（MPP）数据库，数据挖掘</a><a href="https://blog.ytso.com/tag/%e5%bc%80%e6%ba%90%e5%a4%a7%e6%95%b0%e6%8d%ae%e5%b9%b3%e5%8f%b0" rel="tag">开源大数据平台</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e4%b8%ad%e5%8f%b0" rel="tag">数据中台</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e5%88%86%e6%9e%90" rel="tag">数据分析</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e5%bc%80%e5%8f%91" rel="tag">数据开发</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e6%b2%bb%e7%90%86" rel="tag">数据治理</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e6%b9%96" rel="tag">数据湖</a><a href="https://blog.ytso.com/tag/%e6%95%b0%e6%8d%ae%e9%87%87%e9%9b%86" rel="tag">数据采集</a></div>
                        <div class="entry-action">
                            <div class="btn-zan" data-id="7668"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-thumb-up-fill"></use></svg></i> 赞 <span class="entry-action-num">(0)</span></div>
                                                    </div>

                        <div class="entry-bar">
                            <div class="entry-bar-inner">
                                                                <div class="entry-bar-info entry-bar-info2">
                                    <div class="info-item meta">
                                                                                    <a class="meta-item j-heart" href="javascript:;" data-id="7668"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-star"></use></svg></i> <span class="data">0</span></a>                                        <a class="meta-item" href="#comments"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-comment"></use></svg></i> <span class="data">0</span></a>                                                                            </div>
                                    <div class="info-item share">
                                                                                    <a class="meta-item mobile j-mobile-share" href="javascript:;" data-id="7668" data-qrcode="https://blog.ytso.com/tech/bigdata/7668.html">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-share"></use></svg></i> 生成海报                                            </a>
                                                                                    <a class="meta-item wechat" data-share="wechat" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-wechat"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item weibo" data-share="weibo" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-weibo"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item qq" data-share="qq" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qq"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item qzone" data-share="qzone" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-qzone"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item douban" data-share="douban" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-douban"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item linkedin" data-share="linkedin" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-linkedin"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item facebook" data-share="facebook" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-facebook"></use></svg></i>                                            </a>
                                                                                    <a class="meta-item twitter" data-share="twitter" target="_blank" rel="nofollow noopener noreferrer" href="#">
                                                <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-twitter"></use></svg></i>                                            </a>
                                                                            </div>
                                    <div class="info-item act">
                                        <a href="javascript:;" id="j-reading"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-article"></use></svg></i></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                                            <div class="entry-page">
                    <div class="entry-page-prev entry-page-nobg">
                <a href="https://blog.ytso.com/tech/bigdata/7667.html" title="Dubbo服务治理详解大数据" rel="prev">
                    <span>Dubbo服务治理详解大数据</span>
                </a>
                <div class="entry-page-info">
                    <span class="pull-left"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-left-double"></use></svg></i> 上一篇</span>
                    <span class="pull-right">2021年7月18日 22:09</span>
                </div>
            </div>
                            <div class="entry-page-next j-lazy" style="background-image: url('https://blog.ytso.com/wp-content/themes/justnews/themer/assets/images/lazy.png');" data-original="http://blog.ytso.com/img/67581820180527081001458800487473.png">
                <a href="https://blog.ytso.com/tech/bigdata/7669.html" title="分布式系统中zookeeper实现配置管理+集群管理详解大数据" rel="next">
                    <span>分布式系统中zookeeper实现配置管理+集群管理详解大数据</span>
                </a>
                <div class="entry-page-info">
                    <span class="pull-right">下一篇 <i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-arrow-right-double"></use></svg></i></span>
                    <span class="pull-left">2021年7月18日 22:09</span>
                </div>
            </div>
            </div>
                                                                <div class="entry-related-posts">
                            <h3 class="entry-related-title">相关推荐</h3><ul class="entry-related cols-3 post-loop post-loop-list"><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/8936.html" target="_blank" rel="bookmark">
        <span>HDFS的Java客户端操作代码(查看HDFS下所有的文件或目录)详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/8891.html" target="_blank" rel="bookmark">
        <span>共识算法 pos，Dpos详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/9646.html" target="_blank" rel="bookmark">
        <span>Redis详解（四）------ redis的底层数据结构大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/8926.html" target="_blank" rel="bookmark">
        <span>Hadoop伪分布安装详解(二)大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/9806.html" target="_blank" rel="bookmark">
        <span>hadoop join之map side join详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/7686.html" target="_blank" rel="bookmark">
        <span>熟练掌握HDFS的Java API接口访问详解大数据</span>
    </a>
    <span class="date">2021年7月18日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/228087.html" target="_blank" rel="bookmark">
        <span>Hadoop2源码分析－Hadoop V2初识详解大数据</span>
    </a>
    <span class="date">2022年1月11日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/9564.html" target="_blank" rel="bookmark">
        <span>hbase遇到问题及解决方法详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/9102.html" target="_blank" rel="bookmark">
        <span>Hadoop2.7.6_02_HDFS常用操作详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li><li class="item">
    <a href="https://blog.ytso.com/tech/bigdata/9145.html" target="_blank" rel="bookmark">
        <span>hadoop docker集群搭建详解大数据</span>
    </a>
    <span class="date">2021年7月19日</span>
</li></ul>                        </div>
                    
<div id="comments" class="entry-comments">
    	<div id="respond" class="comment-respond">
		<h3 id="reply-title" class="comment-reply-title">发表回复 <small><a rel="nofollow" id="cancel-comment-reply-link" href="/tech/bigdata/7668.html#respond" style="display:none;"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-close"></use></svg></i></a></small></h3><div class="comment-form"><div class="comment-must-login">请登录后评论...</div><div class="form-submit"><div class="form-submit-text pull-left"><a href="https://blog.ytso.com/login">登录</a>后才能评论</div> <button name="submit" type="submit" id="must-submit" class="wpcom-btn btn-primary btn-xs submit">提交</button></div></div>	</div><!-- #respond -->
		</div><!-- .comments-area -->
                </article>
                    </main>
            <aside class="sidebar">
        <div class="widget widget_search"><form class="search-form" action="https://blog.ytso.com/" method="get" role="search">
    <input type="search" class="keyword" name="s" maxlength="100" placeholder="输入关键词搜索..." value="">
    <button type="submit" class="submit"><i class="wpcom-icon wi"><svg aria-hidden="true"><use xlink:href="#wi-search"></use></svg></i></button>
</form></div><error>
    <code>wp_die</code>
    <title><![CDATA[WordPress &amp;rsaquo; Error]]></title>
    <message><![CDATA[&lt;h1&gt;Error establishing a Redis connection&lt;/h1&gt;
&lt;p&gt;To disable Redis, delete the &lt;code&gt;object-cache.php&lt;/code&gt; file in the &lt;code&gt;/wp-content/&lt;/code&gt; directory.&lt;/p&gt;
]]></message>
    <data>
        <status>500</status>
    </data>
</error>
<!--
Performance optimized by Redis Object Cache. Learn more: https://wprediscache.com

Retrieved 2330 objects (564 KB) from Redis using Predis (v2.4.0).
-->
