Lenna  Kihn

Lenna Kihn

1665624754

A Lightweight, Fast But Powerful Redis Cluster Proxy Written in Rust

RCProxy

RCProxy

Forked from https://github.com/wayslog/aster. Thanks!

======================

RCProxy is a lightweight, fast but powerful Redis Cluster Proxy written in Rust.

It supports memcache/redis singleton/redis cluster protocol all in one. RCProxy can proxy with two models:

  1. proxy mode: the same as twemproxy.
  2. cluster mode: proxy for redis cluster. You can use non-cluster redis client access the redis cluster.(Inspired with Corvus)

Usage

Build

cargo build --all --release

Run

./target/release/rcproxy default.toml

Install

sudo cp ./target/release/rcproxy /usr/local/bin/
sudo mkdir /etc/rcproxy
sudo cp default.toml /etc/rcproxy/
sudo mkdir /var/log/rcproxy
sudo cp service/systemd/rcproxy.service /lib/systemd/system/
sudo systemctl enable rcproxy
sudo systemctl start rcproxy

Configuration

[log]
level = "libaster=info" # "trace" "debug" "info" "warn" "error"
ansi = true  # support ANSI colors
stdout = false # print logs to stdout, not to log files
directory = "/var/log/rcproxy" # log file directory
file_name = "rcproxy.log" # log file name

[metrics]
port = 2110

[[clusters]]
# name of the cluster. Each cluster means one front-end port.
name="test-redis-cluster"

# listen_addr means the cluster font end serve address.
listen_addr="0.0.0.0:9001"

# cache_type only support memcache|redis|redis_cluster
cache_type="redis_cluster"

# servers means cache backend. support two format:
# for cache_type is memcache or redis, you can set it as:
#
#   servers = [
#       "127.0.0.1:7001:10 redis-1",
#       "127.0.0.1:7002:10 redis-2",
#       "127.0.0.1:7003:10 redis-3"]
#
# as you can see, the format is consisted with:
#
#       "${addr}:hash_weight ${node_alias}"
#
# And, for redis_cluster you can set the item as:
#
# servers = ["127.0.0.1:7000", "127.0.0.1:7001"]
#
# which means the seed nodes to connect to redis cluster.
servers = ["127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004", "127.0.0.1:7005"]

# Work thread number, it's suggested as the number of your cpu(hyper-thread) number.
thread = 1

# ReadTimeout is the socket read timeout which effects all in the socket in millisecond
read_timeout = 2000

# WriteTimeout is the socket write timeout which effects all in the socket in millisecond
write_timeout = 2000

############################# Cluster Mode Special #######################################################
# fetch means fetch interval for backend cluster to keep cluster info become newer.
# default 10 * 60 seconds
fetch = 600


# read_from_slave is the feature make slave balanced readed by client and ignore side effects.
read_from_slave = true

############################# Proxy Mode Special #######################################################
# ping_fail_limit means when ping fail reach the limit number, the node will be ejected from the cluster
# until the ping is ok in future.
# if ping_fali_limit == 0, means that close the ping eject feature.
ping_fail_limit=3

# ping_interval means the interval of each ping was send into backend node in millisecond.
ping_interval=10000

auth = "" # mypassw

changelog

see CHANGELOG.md


Download Details:

Author: clia
Source Code: https://github.com/clia/rcproxy

License: MIT license

#rust 

What is GEEK

Buddha Community

A Lightweight, Fast But Powerful Redis Cluster Proxy Written in Rust
Loma  Baumbach

Loma Baumbach

1596679140

Redis Transactions & Long-Running Lua Scripts

Redis offers two mechanisms for handling transactions – MULTI/EXEC based transactions and Lua scripts evaluation. Redis Lua scripting is the recommended approach and is fairly popular in usage.

Our Redis™ customers who have Lua scripts deployed often report this error – “BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE”. In this post, we will explain the Redis transactional property of scripts, what this error is about, and why we must be extra careful about it on Sentinel-managed systems that can failover.

Redis Lua Scripts Diagram - ScaleGrid Blog

Transactional Nature of Redis Lua Scripts

Redis “transactions” aren’t really transactions as understood conventionally – in case of errors, there is no rollback of writes made by the script.

Atomicity” of Redis scripts is guaranteed in the following manner:

  • Once a script begins executing, all other commands/scripts are blocked until the script completes. So, other clients either see the changes made by the script or they don’t. This is because they can only execute either before the script or after the script.
  • However, Redis doesn’t do rollbacks, so on an error within a script, any changes already made by the script will be retained and future commands/scripts will see those partial changes.
  • Since all other clients are blocked while the script executes, it is critical that the script is well-behaved and finishes in time.

The ‘lua-time-limit’ Value

It is highly recommended that the script complete within a time limit. Redis enforces this in a weak manner with the ‘lua-time-limit’ value. This is the maximum allowed time (in ms) that the script is allowed to run. The default value is 5 seconds. This is a really long time for CPU-bound activity (scripts have limited access and can’t run commands that access the disk).

However, the script is not killed when it executes beyond this time. Redis starts accepting client commands again, but responds to them with a BUSY error.

If you must kill the script at this point, there are two options available:

  • SCRIPT KILL command can be used to stop a script that hasn’t yet done any writes.
  • If the script has already performed writes to the server and must still be killed, use the SHUTDOWN NOSAVE to shutdown the server completely.

It is usually better to just wait for the script to complete its operation. The complete information on methods to kill the script execution and related behavior are available in the documentation.

#cloud #database #developer #high availability #howto #redis #scalegrid #lua-time-limit #redis diagram #redis master #redis scripts #redis sentinel #redis servers #redis transactions #sentinel-managed #server failures

Lenna  Kihn

Lenna Kihn

1665624754

A Lightweight, Fast But Powerful Redis Cluster Proxy Written in Rust

RCProxy

RCProxy

Forked from https://github.com/wayslog/aster. Thanks!

======================

RCProxy is a lightweight, fast but powerful Redis Cluster Proxy written in Rust.

It supports memcache/redis singleton/redis cluster protocol all in one. RCProxy can proxy with two models:

  1. proxy mode: the same as twemproxy.
  2. cluster mode: proxy for redis cluster. You can use non-cluster redis client access the redis cluster.(Inspired with Corvus)

Usage

Build

cargo build --all --release

Run

./target/release/rcproxy default.toml

Install

sudo cp ./target/release/rcproxy /usr/local/bin/
sudo mkdir /etc/rcproxy
sudo cp default.toml /etc/rcproxy/
sudo mkdir /var/log/rcproxy
sudo cp service/systemd/rcproxy.service /lib/systemd/system/
sudo systemctl enable rcproxy
sudo systemctl start rcproxy

Configuration

[log]
level = "libaster=info" # "trace" "debug" "info" "warn" "error"
ansi = true  # support ANSI colors
stdout = false # print logs to stdout, not to log files
directory = "/var/log/rcproxy" # log file directory
file_name = "rcproxy.log" # log file name

[metrics]
port = 2110

[[clusters]]
# name of the cluster. Each cluster means one front-end port.
name="test-redis-cluster"

# listen_addr means the cluster font end serve address.
listen_addr="0.0.0.0:9001"

# cache_type only support memcache|redis|redis_cluster
cache_type="redis_cluster"

# servers means cache backend. support two format:
# for cache_type is memcache or redis, you can set it as:
#
#   servers = [
#       "127.0.0.1:7001:10 redis-1",
#       "127.0.0.1:7002:10 redis-2",
#       "127.0.0.1:7003:10 redis-3"]
#
# as you can see, the format is consisted with:
#
#       "${addr}:hash_weight ${node_alias}"
#
# And, for redis_cluster you can set the item as:
#
# servers = ["127.0.0.1:7000", "127.0.0.1:7001"]
#
# which means the seed nodes to connect to redis cluster.
servers = ["127.0.0.1:7000", "127.0.0.1:7001", "127.0.0.1:7002", "127.0.0.1:7003", "127.0.0.1:7004", "127.0.0.1:7005"]

# Work thread number, it's suggested as the number of your cpu(hyper-thread) number.
thread = 1

# ReadTimeout is the socket read timeout which effects all in the socket in millisecond
read_timeout = 2000

# WriteTimeout is the socket write timeout which effects all in the socket in millisecond
write_timeout = 2000

############################# Cluster Mode Special #######################################################
# fetch means fetch interval for backend cluster to keep cluster info become newer.
# default 10 * 60 seconds
fetch = 600


# read_from_slave is the feature make slave balanced readed by client and ignore side effects.
read_from_slave = true

############################# Proxy Mode Special #######################################################
# ping_fail_limit means when ping fail reach the limit number, the node will be ejected from the cluster
# until the ping is ok in future.
# if ping_fali_limit == 0, means that close the ping eject feature.
ping_fail_limit=3

# ping_interval means the interval of each ping was send into backend node in millisecond.
ping_interval=10000

auth = "" # mypassw

changelog

see CHANGELOG.md


Download Details:

Author: clia
Source Code: https://github.com/clia/rcproxy

License: MIT license

#rust 

Serde Rust: Serialization Framework for Rust

Serde

*Serde is a framework for serializing and deserializing Rust data structures efficiently and generically.*

You may be looking for:

Serde in action

Click to show Cargo.toml. Run this code in the playground.

[dependencies]

# The core APIs, including the Serialize and Deserialize traits. Always
# required when using Serde. The "derive" feature is only required when
# using #[derive(Serialize, Deserialize)] to make Serde work with structs
# and enums defined in your crate.
serde = { version = "1.0", features = ["derive"] }

# Each data format lives in its own crate; the sample code below uses JSON
# but you may be using a different one.
serde_json = "1.0"

 

use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
struct Point {
    x: i32,
    y: i32,
}

fn main() {
    let point = Point { x: 1, y: 2 };

    // Convert the Point to a JSON string.
    let serialized = serde_json::to_string(&point).unwrap();

    // Prints serialized = {"x":1,"y":2}
    println!("serialized = {}", serialized);

    // Convert the JSON string back to a Point.
    let deserialized: Point = serde_json::from_str(&serialized).unwrap();

    // Prints deserialized = Point { x: 1, y: 2 }
    println!("deserialized = {:?}", deserialized);
}

Getting help

Serde is one of the most widely used Rust libraries so any place that Rustaceans congregate will be able to help you out. For chat, consider trying the #rust-questions or #rust-beginners channels of the unofficial community Discord (invite: https://discord.gg/rust-lang-community), the #rust-usage or #beginners channels of the official Rust Project Discord (invite: https://discord.gg/rust-lang), or the #general stream in Zulip. For asynchronous, consider the [rust] tag on StackOverflow, the /r/rust subreddit which has a pinned weekly easy questions post, or the Rust Discourse forum. It's acceptable to file a support issue in this repo but they tend not to get as many eyes as any of the above and may get closed without a response after some time.

Download Details:
Author: serde-rs
Source Code: https://github.com/serde-rs/serde
License: View license

#rust  #rustlang 

sophia tondon

sophia tondon

1620885491

Microsoft Power BI Consulting | Power BI Solutions in India

Hire top dedicated Mirosoft power BI consultants from ValueCoders who aim at leveraging their potential to address organizational challenges for large-scale data storage and seamless processing.

We have a team of dedicated power BI consultants who help start-ups, SMEs, and enterprises to analyse business data and get useful insights.

What are you waiting for? Contact us now!

No Freelancers, 100% Own Staff
Experienced Consultants
Continuous Monitoring
Lean Processes, Agile Mindset
Non-Disclosure Agreement
Up To 2X Less Time

##power bi service #power bi consultant #power bi consultants #power bi consulting #power bi developer #power bi development

sophia tondon

sophia tondon

1619670565

Hire Power BI Developer | Microsoft Power BI consultants in India

Hire our expert Power BI consultants to make the most out of your business data. Our power bi developers have deep knowledge in Microsoft Power BI data modeling, structuring, and analysis. 16+ Yrs exp | 2500+ Clients| 450+ Team

Visit Website - https://www.valuecoders.com/hire-developers/hire-power-bi-developer-consultants

#power bi service #power bi consultant #power bi consultants #power bi consulting #power bi developer #power bi consulting services