Convert Figma logo to code with AI

flike logokingshard

A high-performance MySQL proxy

6,416
1,234
6,416
161

Top Related Projects

Sync MySQL data into elasticsearch

4,104

A high performance NoSQL Database Server powered by Go

a powerful mysql toolset with Go

Quick Overview

Kingshard is a high-performance MySQL proxy, designed to provide a scalable and highly available MySQL solution. It acts as an intermediary between the application and the MySQL database, handling tasks such as connection pooling, read/write splitting, and sharding.

Pros

  • High Performance: Kingshard is designed to be highly efficient, with low latency and high throughput.
  • Scalability: It supports sharding and read/write splitting, allowing for easy scaling of MySQL infrastructure.
  • Fault Tolerance: Kingshard provides automatic failover and connection retries, improving the overall reliability of the MySQL system.
  • Ease of Use: The project has a well-documented configuration and setup process, making it accessible for developers and operations teams.

Cons

  • Limited Ecosystem: Kingshard is a relatively niche project, with a smaller community and ecosystem compared to more popular MySQL proxy solutions.
  • Maintenance Overhead: Deploying and maintaining Kingshard may require additional effort and expertise, especially for complex MySQL setups.
  • Limited Feature Set: While Kingshard provides core proxy functionality, it may lack some advanced features found in other MySQL proxy solutions.
  • Vendor Lock-in: Adopting Kingshard may introduce a degree of vendor lock-in, as migrating to a different proxy solution may require significant effort.

Code Examples

N/A (Kingshard is not a code library)

Getting Started

To get started with Kingshard, follow these steps:

  1. Download the latest release of Kingshard from the GitHub repository.

  2. Extract the downloaded archive and navigate to the kingshard directory.

  3. Create a configuration file (e.g., conf/kingshard.xml) based on the sample configuration.

  4. Modify the configuration file to match your MySQL infrastructure, including the backend MySQL servers, user credentials, and other settings.

  5. Start the Kingshard server by running the following command:

    ./kingshard -config=conf/kingshard.xml
    
  6. Verify that Kingshard is running correctly by checking the logs and connecting to the proxy using a MySQL client.

  7. Integrate your application with Kingshard by updating the connection details to point to the Kingshard proxy instead of the backend MySQL servers.

For more detailed instructions and configuration options, please refer to the Kingshard documentation.

Competitor Comparisons

Sync MySQL data into elasticsearch

Pros of go-mysql-elasticsearch

  • Specialized for MySQL to Elasticsearch synchronization
  • Supports real-time data replication
  • Offers flexible configuration options for mapping MySQL data to Elasticsearch

Cons of go-mysql-elasticsearch

  • Limited to MySQL and Elasticsearch integration
  • May require additional setup for complex data transformations
  • Less suitable for general-purpose database proxy use cases

Code Comparison

kingshard:

type Schema struct {
    db    string
    table string
    nodes []string
}

go-mysql-elasticsearch:

type Config struct {
    MyAddr     string `toml:"my_addr"`
    MyUser     string `toml:"my_user"`
    MyPassword string `toml:"my_pass"`
    MyCharset  string `toml:"my_charset"`

    ESAddr string `toml:"es_addr"`

    ServerID uint32 `toml:"server_id"`
    Flavor   string `toml:"flavor"`
    DataDir  string `toml:"data_dir"`
}

Key Differences

  • kingshard is a MySQL proxy for sharding and read/write splitting
  • go-mysql-elasticsearch focuses on MySQL to Elasticsearch data synchronization
  • kingshard offers more general database management features
  • go-mysql-elasticsearch provides specialized Elasticsearch integration

Both projects are written in Go and cater to MySQL-related use cases, but they serve different primary purposes within database ecosystems.

4,104

A high performance NoSQL Database Server powered by Go

Pros of ledisdb

  • Multi-model database supporting Redis, LevelDB, and RocksDB backends
  • Supports advanced data structures like ZSet, Hash, and List
  • Offers persistence and replication features

Cons of ledisdb

  • Limited sharding capabilities compared to kingshard
  • May have higher memory usage due to supporting multiple data models
  • Less focused on MySQL-specific optimizations

Code Comparison

ledisdb:

db, err := ledis.Open(cfg)
if err != nil {
    panic(err)
}
defer db.Close()

kingshard:

cfg, err := config.ParseConfigFile(*configFile)
if err != nil {
    panic(err)
}
proxy := server.NewServer(cfg)

Key Differences

  1. Purpose: ledisdb is a multi-model database, while kingshard is a MySQL proxy and sharding solution.
  2. Data Models: ledisdb supports various data structures, kingshard focuses on relational data.
  3. Sharding: kingshard provides more advanced sharding capabilities for MySQL.
  4. Language: Both are written in Go, but have different focuses and use cases.
  5. Performance: kingshard may offer better performance for MySQL-specific operations, while ledisdb provides flexibility across different data models.

a powerful mysql toolset with Go

Pros of go-mysql-org/go-mysql

  • Comprehensive MySQL Client Library: go-mysql-org/go-mysql provides a comprehensive MySQL client library, allowing developers to interact with MySQL databases using idiomatic Go code.
  • Replication Support: The library includes support for MySQL replication, enabling developers to build applications that can consume and process data from MySQL replicas.
  • Flexible API: The API of go-mysql-org/go-mysql is designed to be flexible and easy to use, making it a suitable choice for a wide range of MySQL-related projects.

Cons of go-mysql-org/go-mysql

  • Limited Documentation: Compared to flike/kingshard, the documentation for go-mysql-org/go-mysql may be less comprehensive, making it more challenging for new users to get started.
  • Fewer Features: While go-mysql-org/go-mysql is a powerful MySQL client library, it may not offer the same level of advanced features and functionality as flike/kingshard, which is designed as a MySQL proxy.
  • Potential Performance Overhead: As a client library, go-mysql-org/go-mysql may have slightly higher performance overhead compared to a proxy-based solution like flike/kingshard, especially for high-throughput applications.

Code Comparison

Here's a brief code comparison between go-mysql-org/go-mysql and flike/kingshard:

go-mysql-org/go-mysql (establishing a connection):

db, err := sql.Open("mysql", "user:password@tcp(127.0.0.1:3306)/database")
if err != nil {
    // handle error
}
defer db.Close()

flike/kingshard (configuring a proxy):

# kingshard.yml
name: test
addr: 0.0.0.0:3306
user: root
password: root
nodes:
  - name: node1
    address: 127.0.0.1:3306
    user: root
    password: root
    database: test

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

kingshard 中文主页

Build Status

Overview

kingshard is a high-performance proxy for MySQL powered by Go. Just like other mysql proxies, you can use it to split the read/write sqls. Now it supports basic SQL statements (select, insert, update, replace, delete). The most important feature is the sharding function. Kingshard aims to simplify the sharding solution of MySQL. The Performance of kingshard is about 80% compared to connecting to MySQL directly.

Feature

1. Basic Function

  • Splits reads and writes
  • Client's ip ACL control.
  • Transaction in single node.
  • Support limiting the max count of connections to MySQL database.
  • Support setting the backend database online or offline dynamically.
  • Supports prepared statement: COM_STMT_PREPARE, COM_STMT_EXECUTE, etc.
  • Support multi slaves, and load balancing between slaves.
  • Support reading master database forcely.
  • Support last_insert_id().
  • Support MySQL backends HA.
  • Support set the charset of proxy.
  • Support SQL blacklist.
  • Support dynamically changing the config value of kingshard.

2. Sharding Function

  • Support hash,range and date sharding across multiple nodes.
  • Support sending sql to the specified node.
  • Support most commonly used functions, such as max, min, count, sum, and also support join, limit, order by,group by.

Install

  1. Install Go
  2. git clone https://github.com/flike/kingshard.git $GOPATH/src/github.com/flike/kingshard
  3. cd $GOPATH/src/github.com/flike/kingshard
  4. source ./dev.sh
  5. make
  6. set the config file (etc/ks.yaml)
  7. run kingshard (./bin/kingshard -config=etc/ks.yaml)

Details of kingshard

1.How to use kingshard building a MySQL cluster

License

kingshard is under the Apache 2.0 license. See the LICENSE directory for details.