go install github.com/DGKSK8LIFE/redisql/redisql
Create a YAML file with the following structure:
sqltype:
sqluser:
sqlpassword:
sqldatabase:
sqlhost:
sqlport:
sqltable:
redisaddr:
redispass:
# copy to redis string
redisql copy -type=string -config=pathtofile.yml
# copy to redis list
redisql copy -type=list -config=pathtofile.yml
# copy to redis hash
redisql copy -type=hash -config=pathtofile.yml
go get github.com/DGKSK8LIFE/redisql
package main
import (
"github.com/DGKSK8LIFE/redisql"
)
func main() {
config := redisql.Config{
SQLType: "mysql",
SQLUser: "root",
SQLPassword: "password",
SQLDatabase: "users",
SQLHost: "localhost",
SQLPort: "3306",
SQLTable: "user",
RedisAddr: "localhost:6379",
RedisPass: "",
}
err := config.CopyToString()
if err != nil {
panic(err)
}
}
// copy to redis list
config.CopyToList()
// copy to redis hash
config.CopyToHash()
Check out CONTRIBUTING
- Simple copying of entire MySQL tables to Redis via CLI and Go Module
- Improved logs (optional CLI output, improved formatting)
- Support for most commonly used Redis data types (strings, lists, hashes)
- Support for Postgres
- Autosync