In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Download the program http://down.51cto.com/data/2440789:
Click the client to test the connection. The following figure shows that the test is successful.
Normal connection redis
Pipes: you can execute multiple commands at a time
Import redispool = redis.ConnectionPool (host='127.0.0.1',port=6379) # connection pool # r = redis.Redis (host='127.0.0.1',port=6379) r = redis.Redis (connection_pool=pool) pipe = r.pipeline (transaction=True) r.set ('foo','bar') r.set (' zhangsan','heheheh') pipe.execute ()
Implement subscription and publishing
Server side (publisher side):
Import redispool = redis.ConnectionPool (host= "127.0.0.1", port='6379') rc = redis.Redis (connection_pool=pool) while True: mes = str (input ("Please enter what you want to publish:") rc.publish ('fm100.5', mes)
Client (subscriber):
Import redispool = redis.ConnectionPool (host= "127.0.0.1", port='6379') rc = redis.Redis (connection_pool=pool) ps = rc.pubsub () # Open ps.subscribe (['fm100.5']) # FM for item in ps.listen (): # listening if item [' type'] = 'message': data = item [' data'] print (data.decode ('utf-8'))
Official account of Wechat
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.