Skip to content

Instantly share code, notes, and snippets.

View nju520's full-sized avatar

nju520 nju520

View GitHub Profile
@xifengzhu
xifengzhu / Rails 实现读写分离(MySQL).md
Last active April 10, 2022 07:41
Rails 实现读写分离(MySQL)

常用的实现读写分离的方式有如下两种

  • 第三方中间件,比较成熟的有Mysql官方提供的 MySQL Router以及 360公司基于MySQL-Proxy 0.8.2开发的开源 Atlas

  • 其次就是在应用中做解决,在 ActiveRecord中做做处理, 如:octopus

本次实践的是用 gem octopus来实现读写分离。

为了模拟读写分离,将 MySQL 分别安装在了本地 Mac 和阿里云 Linux 系统上,MacMySQL 作为写入数据库,而Linux的作为读取数据库。

@renshuki
renshuki / ubuntu_agnoster_install.md
Last active July 11, 2024 15:06
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

@mebens
mebens / Vector.lua
Created June 30, 2011 01:56
Vector class for my tutorial on Lua metatables.
Vector = {}
Vector.__index = Vector
function Vector.__add(a, b)
if type(a) == "number" then
return Vector.new(b.x + a, b.y + a)
elseif type(b) == "number" then
return Vector.new(a.x + b, a.y + b)
else
return Vector.new(a.x + b.x, a.y + b.y)