Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use redis micro-application image

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how to use the Redi micro-application image, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article. Let's take a look at it.

Suma redis micro-application image is a redis micro-container cluster image for secondary development based on redis 5.0source code. Add commands related to suma apollo microcontainers to the original reids commands

Sumavlib.suma_ci_task

Sumavlib.suma_keep_alive

Sumavlib.suma_try_leader

Sumavlib.suma_vip_list

Sumavlib.suma_vip_register

Sumavlib.suma_vip_server_list

Sumavlib.suma_vip_kill

Sumavlib.suma_vip_reset

Sumavlib.suma_diamond_publish

Sumavlib.suma_diamond_list

one。 Primitive API Overview 1 Election leader sumavlib.suma_try_leader # 1 # 2

Parameter 1 master_vipkey consists of owner and service id + "master"

Parameter 2 vip address of the current host

Master returns 1, slave returns 0

Example sumavlib.suma_try_leader wangwenbo_test_master

2 get host VIP list sumavlib.suma_vip_list # 1 # 2

Parameter 1 master vip

Parameter 2 query string

Returns the vip list of active hosts

According to the online host, the vip is cached by lru according to the survival status, and if it is lost, it will be expelled by the system.

Example sumavlib.suma_try_leader wangwenbo_test_master suma*

3 activate host status sumavlib.suma_keep_alive # 1 # 2 # 3

Parameter 1 master_vipkey consists of owner and service id + "master"

Parameter 2 vip address of the current host

Parameter 3 vip list index mode

Return master return vip list, slave return master vip

Example sumavlib.suma_keep_alive vip vip vip*

4 forcibly remove a host traffic sumavlib.suma_vip_kill # channel # vip

Parameter 1 id of the subscribed channel

Parameter 2 Host vip to be removed

Return success return 1 failure return 0

Example sumavlib.suma_vip_kill subid vip

This api is a private primitive and can only remove the traffic from the host corresponding to the vip.

5 forcibly restore a host traffic sumavlib.suma_vip_reset # channel # vip

Parameter 1 id of the subscribed channel

Parameter 2 Host vip to be removed

Return success return 1 failure return 0

Example sumavlib.suma_vip_reset subid vip

This api is a private primitive that restores traffic to the host corresponding to the vip.

6 subscribed channels publish sumavlib.suma_message_publish # channel # cmd json

Parameter 1 id of the subscribed channel

Parameter 2 json commands that need to be processed

Return success return 1 failure return 0

Example sumavlib.suma_message_publish subid cmd

This api is a private primitive, and all vip hosts whose business id is consistent under this owner will receive a broadcast.

7 diamond configuration release sumavlib.suma_diamond_publish # channel # cmd json # key

Parameter 1 id of the subscribed channel

Parameter 2 needs to store the key

Parameter 3 needs to store the value

Return success return 1 failure return 0

Example sumavlib.suma_diamond_publish subid key value

This api is a private primitive, and all vip hosts whose business id is consistent under this owner will receive a broadcast.

Sumavlib.suma_diamond_publish owner_idbuiness_idchannel key value

8 diamond configuration Index list sumavlib.suma_diamond_list # 1

Parameter 1 non-blocking search mode

Returns the list of the index

Example sumavlib.suma_diamond_list pp*

The non-blocking index search pattern is an unordered iteration with a maximum of 100.

9 tenant vip list sumavlib.suma_vip_server_list # 1

Parameter 1 non-blocking search mode

Returns the list of the index

Example sumavlib.suma_vip_server_list pp*

10 tenant vip Registration sumavlib.suma_vip_register_list # 1

Parameter 1 non-blocking search mode

Returns the list of the index

Example sumavlib.suma_diamond_list pp*

Start

Sh rm_all_container.sh ip= `cat / home/admin/local_ ip`docker run-it-v / home/admin/logs2:/home/admin/logs\-- env LOCAL_IP= "$ip"\-- env CONTAINER_TYPE= "docker"\-- env APOLLO_OWNER_ID= "agent.zy"\-- env APOLLO_BUINESS_ID= "test"\-- env APOLLO_PORT=9001\-p 9002run 10082-p 9001run 8090\-- rm registry-1.docker.io/459733390/suma_apollo_redis:latest

After miniaturization, the size of the suma redis image is reduced to 15m, and each tenant is completely isolated. You can use suma apollo microcontainers for container management and dynamic expansion.

You can use the image source to manage the image, or you can use the compressed package. The image of this microcontainer is still a container that meets the oci standard, so as long as the docker software exists on the target machine, we can deploy it dynamically, so the image based on the suma apollo microcontainer engine can be deployed online within 1 second.

The goal is to isolate the tenant's resources (redis,vcpu, applications, data, etc.), so that the tenant can flexibly purchase resources online and assemble them into the tenant's own business logic link.

Thank you for reading this article carefully. I hope the article "how to use Redis Micro Application Image" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report