All Projects → MohamedBassem → Getaredis

MohamedBassem / Getaredis

Licence: other
A one click, docker based, auto scaling, Redis host implemented in Go and hosted on Digitalocean.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Getaredis

Csredis
.NET Core or .NET Framework 4.0+ client for Redis and Redis Sentinel (2.8) and Cluster. Includes both synchronous and asynchronous clients.
Stars: ✭ 1,714 (+1169.63%)
Mutual labels:  redis
Vagrant Elastic Stack
Giving the Elastic Stack a try in Vagrant
Stars: ✭ 131 (-2.96%)
Mutual labels:  redis
Hippo
💨A well crafted go packages that help you build robust, reliable, maintainable microservices.
Stars: ✭ 134 (-0.74%)
Mutual labels:  redis
Sk Admin
基于 Spring Boot、 Spring Data JPA、 Spring Security、Vue 的前后端分离的管理系统。项目采用模块开发方式, 主要模块:权限管理 (RBAC(Role-Based Access Control,基于角色的访问控制),支持数据字典、数据权限管理、前端菜单支持动态路由)、日志管理、代码生成器、系统监控、云存储管理、系统工具等等
Stars: ✭ 130 (-3.7%)
Mutual labels:  redis
Zhttp
基于swoole的异步轻量级web框架,内部封装协程异步非阻塞全套mysql、redis、mongo、memcached连接池,可以轻松start、reload、stop,加入数据库的查询模块,框架已经封装好近乎同步写法,底层异步调用
Stars: ✭ 131 (-2.96%)
Mutual labels:  redis
Autoloadcache
AutoLoadCache 是基于AOP+Annotation等技术实现的高效的缓存管理解决方案,实现缓存与业务逻辑的解耦,并增加异步刷新及“拿来主义机制”,以适应高并发环境下的使用。
Stars: ✭ 1,794 (+1228.89%)
Mutual labels:  redis
Async Redis
First class async & promise support for redis.
Stars: ✭ 128 (-5.19%)
Mutual labels:  redis
Awesome Travel
Do you want to build a travel app?
Stars: ✭ 133 (-1.48%)
Mutual labels:  digitalocean
Scredis
Non-blocking, ultra-fast Scala Redis client built on top of Akka IO.
Stars: ✭ 131 (-2.96%)
Mutual labels:  redis
Echo
🦄 开源社区系统:基于 SpringBoot + MyBatis + MySQL + Redis + Kafka + Elasticsearch + Spring Security + ... 并提供详细的开发文档和配套教程。包含帖子、评论、私信、系统通知、点赞、关注、搜索、用户设置、数据统计等模块。
Stars: ✭ 129 (-4.44%)
Mutual labels:  redis
Ardb
A redis protocol compatible nosql, it support multiple storage engines as backend like Google's LevelDB, Facebook's RocksDB, OpenLDAP's LMDB, PerconaFT, WiredTiger, ForestDB.
Stars: ✭ 1,707 (+1164.44%)
Mutual labels:  redis
Sanic session
Provides server-backed sessions for Sanic using Redis, Memcache and more.
Stars: ✭ 131 (-2.96%)
Mutual labels:  redis
Goch
Self hosted live chat server written in Go
Stars: ✭ 133 (-1.48%)
Mutual labels:  redis
Lowkiq
Ordered background jobs processing
Stars: ✭ 129 (-4.44%)
Mutual labels:  redis
Nosqlmap
Automated NoSQL database enumeration and web application exploitation tool.
Stars: ✭ 1,928 (+1328.15%)
Mutual labels:  redis
Spring Boot Quick
🌿 基于springboot的快速学习示例,整合自己遇到的开源框架,如:rabbitmq(延迟队列)、Kafka、jpa、redies、oauth2、swagger、jsp、docker、spring-batch、异常处理、日志输出、多模块开发、多环境打包、缓存cache、爬虫、jwt、GraphQL、dubbo、zookeeper和Async等等📌
Stars: ✭ 1,819 (+1247.41%)
Mutual labels:  redis
Jiiiiiin Security
一个前后端分离的内管基础项目
Stars: ✭ 132 (-2.22%)
Mutual labels:  redis
Sourcecodeofmongoredis
《左手MongoDB,右手Redis——从入门到商业实战》书籍配套源代码。
Stars: ✭ 135 (+0%)
Mutual labels:  redis
Redis
《Redis Command Reference》全文的中文翻译版。
Stars: ✭ 1,700 (+1159.26%)
Mutual labels:  redis
Roothub
使用 SSM 和 MySQL 开发的论坛系统
Stars: ✭ 131 (-2.96%)
Mutual labels:  redis

#Get A Redis

A one click, docker based, auto scaling, Redis host implemented in Go and hosted on Digitalocean.

Homepage

##Tags

  • Docker
  • Redis
  • Digitalocean
  • Service Discovery
  • Auto Scalability

##Why?

I started the project to enhance my Go skills which I started to learn few weeks ago. Then I found that the idea may be useful for hackathons and proof of concept projects.

##Technical Details

###System Components

####Go Server

Running martini to serve the webpage and accepts starting new instance requests. Nginx is installed on this machine to act as a reverse proxy for martini.

####Go Jobs

Currently two jobs are scheduled to run every certain amount of time. The first one is a job to kill the containers that has been running for a preconfigured amount of time. The second one is a job to spin up and tear down digitalocean droplets based on the current load of the other servers.

####Docker Hosts

Digitalocean droplets that are used to host redis containers. Nginx is installed on those machines to act as a reverse proxy to the running docker daemon with HTTP authentication.

####Redis

Redis is used only for service discovery. Service discovery will be explained in a later section.

####MySQL Database

To store the details of the running containers, such as the container host, port, id, state and the creator IP. All of the containers' information could be collected from running docker hosts but the database is mainly used for throttling the number of containers per IP.

###System Architecture

System Architecture

The server, running nginx, listens for requests on port 80 and forwards those requests to Go running Martini as a web framework. Go queries redis, which will be explained later, for active docker hosts. Go then tries to schedule the new container on one of the hosts based on a certain criteria. The current criteria is to try to schedule as much containers as possible on the host to reduce the running costs, since it's currently a free service 😬. The maximum number of containers per host is configurable. The server then schedules the container on the chosen host and insert these data into the database. The details of the scheduled container (host, port, redis password) are returned back to the user. The user can then connect to the redis container directly. A background job runs every 20 minutes to kill containers that have passed their maximum allowed number of hours, currently 12 hours.

####Auto Scaling

Another job runs in the background every 10 minutes to check the load of the docker hosts. Since the containers have a maximum memory of 5MB, the load is estimated by the number of containers running on each host. As we mentioned before scheduling tries to add more containers to the busiest hosts as long as they can hold more. Another host is waiting in a standby state. Whenever the standby host starts getting some containers, the job will start another container. Whenever the job detects that there are more that one host containing no containers, it kills them until one is left.

####Service Discovery

Service discovery is needed because we have automatically scaling hosts that the scheduler needs to detect. The are many tools that can be used for service discovery, such as Apache Zookeeper, etcd and Consul. I needed a very simple discovery service so I decided to implement my own.

Redis has a command to expire some key after a certain amount of time. Whenever this command is called it resets the timeout. Using this idea, docker hosts can add a key for themselves in redis and constantly refreshes the timeout. If the key times out, this means that the host didn't send a heartbeat which means that it got disconnected.

The code is as simple as this:

#!/bin/bash
(
 PRIVATE_IP=$(curl http://169.254.169.254/metadata/v1/interfaces/private/0/ipv4/address)
 echo "AUTH <REDIS_PASSWORD>";
 while true; do
 NUMBER_OF_CONTAINERS=$(($(docker ps | wc -l) - 1))
 echo "SET server:$NODE_NAME '{\"PrivateIP\":\"$PRIVATE_IP\",\"NumberOfContainers\":$NUMBER_OF_CONTAINERS}'";
 echo "EXPIRE server:$NODE_NAME 10";
 sleep 4;
 done
 ) | telnet REDIS_IP REDIS_PORT

##TODO

  • Open Docker port on hosts for the master.
  • Pull redis image on new hosts.
  • Authenticate redis master when connecting to docker hosts.
  • Supporting more containers other than redis.
  • Monitoring console.
  • Better deployment method.
  • Better documentation.

##Note The project is still in beta and not 100% stable.

##Contribution Your contributions and ideas are welcomed through issues and pull requests.

##License Copyright (c) 2015, Mohamed Bassem. (MIT License)

See LICENSE for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].