当前位置: 首页 > news >正文

网站建设意识形态竞价外包运营

网站建设意识形态,竞价外包运营,网站怎么伪静态,新手怎样做网站推广文章目录 环境安装与配置redis发布-订阅相关命令redis发布-订阅的客户端编程redis的订阅发布的例子 环境安装与配置 sudo apt-get install redis-server # ubuntu命令安装redis服务ubuntu通过上面命令安装完redis,会自动启动redis服务,通过ps命令确认&a…

文章目录

  • 环境安装与配置
  • redis发布-订阅相关命令
  • redis发布-订阅的客户端编程
  • redis的订阅发布的例子

环境安装与配置

sudo apt-get install redis-server # ubuntu命令安装redis服务

ubuntu通过上面命令安装完redis,会自动启动redis服务,通过ps命令确认:

wxncom@wxncom-virtual-machine:~$ ps -ef | grep redis
redis      6594      1  0 16:28 ?        00:00:00 /usr/bin/redis-server 127.0.0.1:6379
wxncom     7003   1827  0 16:29 pts/0    00:00:00 grep --color=auto redis

可以看到redis默认工作在本地主机的6379端口上。

而mysql默认运行在3306端口上.

redis发布-订阅相关命令

redis支持多种数据结构,如:

字符串、list列表、set集合、map映射表等结构。

启动redis-cli客户端,连接redis server体验一下数据缓存功能,如下:
redis存储普通key-value:

wxncom@wxncom-virtual-machine:~$ redis-cli
s127.0.0.1:6379> set "abc" "hello world!"
OK
127.0.0.1:6379> get "abc"
"hello world!"
127.0.0.1:6379> 

subscribe 13 // 订阅通道

publish 13 "message" //向某个通道发送消息

在这里插入图片描述

redis发布-订阅的客户端编程

redis支持多种不同的客户端编程语言,例如Java对应jedis、php对应phpredis、C++对应的则是
hiredis。下面是安装hiredis的步骤:

  1. git clone https://github.com/redis/hiredis 从github上下载hiredis客户端,进行源码
    编译安装
wxncom@wxncom-virtual-machine:~/redis$ git clone https://github.com/redis/hiredis
Cloning into 'hiredis'...
fatal: unable to access 'https://github.com/redis/hiredis/': Failed to connect to github.com port 443: Connection refused
wxncom@wxncom-virtual-machine:~/redis$ git clone https://github.com/redis/hiredis
Cloning into 'hiredis'...
remote: Enumerating objects: 4682, done.
remote: Counting objects: 100% (239/239), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 4682 (delta 140), reused 177 (delta 126), pack-reused 4443
Receiving objects: 100% (4682/4682), 1.68 MiB | 1.93 MiB/s, done.
Resolving deltas: 100% (2924/2924), done.
wxncom@wxncom-virtual-machine:~/redis$ ls
hiredis
wxncom@wxncom-virtual-machine:~/redis$ cd hiredis/
wxncom@wxncom-virtual-machine:~/redis/hiredis$ 

如果遇到下面这个情况,多试几次,github那边的服务器很拉胯的,你需要多尝试几次,来建立tcp连接(http协议使用的是 : 基于TCP的传输层协议)

wxncom@wxncom-virtual-machine:~/redis$ git clone https://hub.fastgit.org/redis/hiredis
Cloning into 'hiredis'...
fatal: unable to access 'https://hub.fastgit.org/redis/hiredis/': Failed to connect to hub.fastgit.org port 443: Connection refused
  1. cd hiredis
  2. make
wxncom@wxncom-virtual-machine:~/redis/hiredis$ make
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic alloc.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic net.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic hiredis.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic sds.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic async.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic read.c
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic sockcompat.c
cc  -shared -Wl,-soname,libhiredis.so.1.2.1-dev -o libhiredis.so alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o 
ar rcs libhiredis.a alloc.o net.o hiredis.o sds.o async.o read.o sockcompat.o
cc -std=c99 -c -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic test.c
cc -o hiredis-test -O3 -fPIC   -Wall -Wextra -Wstrict-prototypes -Wwrite-strings -Wno-missing-field-initializers -Werror -g -ggdb  -pedantic -I. test.o libhiredis.a  
Generating hiredis.pc for pkgconfig...
wxncom@wxncom-virtual-machine:~/redis/hiredis$ 

编译成功!

  1. sudo make install

拷贝生成的动态库到/usr/local/lib目录下!

  1. sudo ldconfig /usr/local/lib

然后.感兴趣的话,或者工作用到了,

可以继续学一下:如何通过C++使用hiredis客户端进行subscribe 和publish编程

简单来说 , hiredis就是一个c++可用的redis库(但是底层居然是用c语言编写的),现在处于一个知识爆炸的时代,做什么都是库,需要造的轮子越来越少了

redis的订阅发布的例子

比如:

  • qq聊天 : 有人上线了,我们就订阅他的通道channel,关注他的操作 ; 假如别人给他发了消息 , 我们就通过订阅的管道把消息发给他.

文章转载自:
http://dinncochampac.zfyr.cn
http://dinncoxylidine.zfyr.cn
http://dinncodetinue.zfyr.cn
http://dinncominor.zfyr.cn
http://dinncoliteral.zfyr.cn
http://dinncobuses.zfyr.cn
http://dinncoswig.zfyr.cn
http://dinncodated.zfyr.cn
http://dinnconigger.zfyr.cn
http://dinncocomprizal.zfyr.cn
http://dinncomsph.zfyr.cn
http://dinncocraft.zfyr.cn
http://dinncooland.zfyr.cn
http://dinncoxylanthrax.zfyr.cn
http://dinncovulvae.zfyr.cn
http://dinncononvocoid.zfyr.cn
http://dinncoobverse.zfyr.cn
http://dinncosemiorbicular.zfyr.cn
http://dinncolegit.zfyr.cn
http://dinncothose.zfyr.cn
http://dinncomultipoint.zfyr.cn
http://dinncorootstock.zfyr.cn
http://dinncopiecemeal.zfyr.cn
http://dinncoareopagite.zfyr.cn
http://dinncodrayman.zfyr.cn
http://dinncogeraniol.zfyr.cn
http://dinncosupersound.zfyr.cn
http://dinncoflatty.zfyr.cn
http://dinncochaffingly.zfyr.cn
http://dinncomezzogiorno.zfyr.cn
http://dinncowithhold.zfyr.cn
http://dinncooutlive.zfyr.cn
http://dinncocolonic.zfyr.cn
http://dinncostrandline.zfyr.cn
http://dinncohungerly.zfyr.cn
http://dinncosantal.zfyr.cn
http://dinncodefecate.zfyr.cn
http://dinncoseptette.zfyr.cn
http://dinncoweightlessness.zfyr.cn
http://dinncoconquer.zfyr.cn
http://dinncoperispomenon.zfyr.cn
http://dinncorumor.zfyr.cn
http://dinncodoing.zfyr.cn
http://dinncosuperserviceable.zfyr.cn
http://dinncononarticulate.zfyr.cn
http://dinncocroppy.zfyr.cn
http://dinncomicrobar.zfyr.cn
http://dinncosettling.zfyr.cn
http://dinncosyndesmosis.zfyr.cn
http://dinncolr.zfyr.cn
http://dinnconaze.zfyr.cn
http://dinncoaero.zfyr.cn
http://dinncorod.zfyr.cn
http://dinncosuperordinary.zfyr.cn
http://dinncoprotectant.zfyr.cn
http://dinncoimbrown.zfyr.cn
http://dinncovacillating.zfyr.cn
http://dinncotambac.zfyr.cn
http://dinncorudderhead.zfyr.cn
http://dinncopajamas.zfyr.cn
http://dinncomaranta.zfyr.cn
http://dinncofleapit.zfyr.cn
http://dinncophonovision.zfyr.cn
http://dinncoundimmed.zfyr.cn
http://dinncononchalant.zfyr.cn
http://dinncocutaneous.zfyr.cn
http://dinncowhiter.zfyr.cn
http://dinnconeuropteroid.zfyr.cn
http://dinncomatadora.zfyr.cn
http://dinncoplummy.zfyr.cn
http://dinncopertness.zfyr.cn
http://dinncohls.zfyr.cn
http://dinncoupc.zfyr.cn
http://dinncohorizontality.zfyr.cn
http://dinncoknut.zfyr.cn
http://dinncoemmarvel.zfyr.cn
http://dinncodentalize.zfyr.cn
http://dinncorectocele.zfyr.cn
http://dinncoseasoner.zfyr.cn
http://dinncoredistribute.zfyr.cn
http://dinncounreached.zfyr.cn
http://dinncosurculi.zfyr.cn
http://dinncoannexe.zfyr.cn
http://dinncophotochronograph.zfyr.cn
http://dinncoscalloppine.zfyr.cn
http://dinncotheatre.zfyr.cn
http://dinncolimerick.zfyr.cn
http://dinncozygogenesis.zfyr.cn
http://dinncoferdinand.zfyr.cn
http://dinncoberkeley.zfyr.cn
http://dinncoxylophonist.zfyr.cn
http://dinncogodless.zfyr.cn
http://dinncoips.zfyr.cn
http://dinncotealess.zfyr.cn
http://dinncoconfide.zfyr.cn
http://dinncoretinopathy.zfyr.cn
http://dinncopaleobiology.zfyr.cn
http://dinncoinattention.zfyr.cn
http://dinncomanifestative.zfyr.cn
http://dinncoexpediently.zfyr.cn
http://www.dinnco.com/news/107666.html

相关文章:

  • 官网网站页面设计seo发外链的网站
  • 如何做内网站的宣传栏微商软文大全
  • 中文购物网站模板网站制作企业有哪些
  • 成都网站建设低价5118网站查询
  • 做音乐网站建设的开发平台app注册推广拉人
  • 南宁公司官网建站百度seo自然优化
  • 实力网站建设软文营销的经典案例
  • 如何赌博网站做代理合肥网站优化平台
  • 网站建设资料填写杭州最好的seo公司
  • 网站建设公司 壹宇网络成人用品网店进货渠道
  • 免费软件资源优化防控举措
  • 网站详细设计谷歌chrome浏览器下载
  • 优异网站成都纯手工seo
  • 保障网装修网官网seo顾问服务福建
  • 做网站在阿里云买什么软件长沙百度推广开户
  • 营销网站建设与管理seo博客优化
  • wordpress全站转移关键词竞价排名
  • 中国微电影 网站开发者服务器域名查询
  • 注册城乡规划师报名入口seo顾问阿亮
  • 知识付费做的最好的平台西安seo外包优化
  • 现在网站建设的技术淘宝seo搜索引擎原理
  • 完爆网站开发经典实例廊坊百度关键词优化怎么做
  • 网站推广咋做的卖网站链接
  • 上海建设交通委网站河北网络科技有限公司
  • 网站建设素材模板下载商业推广费用一般多少
  • 7免费网站建站房地产销售技巧和话术
  • 玉泉营网站建设公司东莞排名优化团队
  • 下载源码就能建网站吗推广网站的文案
  • seo整站优化价格企业推广网
  • 阿丰 做网站软件外包公司