├── .gitignore ├── Dockerfile ├── Vagrantfile └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:14.04 2 | 3 | MAINTAINER James R. Carr 4 | 5 | ENV DEBIAN_FRONTEND noninteractive 6 | 7 | RUN apt-get update 8 | RUN apt-get install git wget unzip -yq 9 | 10 | 11 | RUN git clone https://github.com/jamescarr/mcrouter.git /tmp/mcrouter 12 | 13 | RUN cd /tmp/mcrouter/mcrouter/scripts \ 14 | && ./install_ubuntu_14.04.sh /usr/local/share 15 | 16 | RUN ln -s /usr/local/share/install/bin/mcrouter /usr/local/bin/mcrouter 17 | 18 | ## Cleanup! 19 | RUN rm -rf /tmp/* 20 | ENV DEBIAN_FRONTEND newt 21 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! 5 | VAGRANTFILE_API_VERSION = "2" 6 | 7 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 8 | config.vm.box = "3scale/docker" 9 | 10 | config.vm.network "private_network", ip: "192.168.33.10" 11 | 12 | config.ssh.forward_agent = true 13 | 14 | config.vm.synced_folder ".", "/home/vagrant/mcrouter" 15 | 16 | config.vm.provider "virtualbox" do |v| 17 | v.memory = 4084 18 | v.cpus = 2 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # mcrouter 2 | This is a docker image for [facebook's mcrouter](https://www.facebook.com/Engineering/posts/10152044187717200), built with blood, sweat 3 | and a glass of scotch. Enjoy. 4 | 5 | ## Usage 6 | 7 | For now we simply expose the mcrouter command for your enjoyment by 8 | directly interacting with it. Not sugar here! 9 | 10 | 11 | ``` 12 | docker run -p 5000:5000 jamescarr/mcrouter:1.0 mcrouter --help 13 | 14 | ``` 15 | 16 | Or to run two memcache containers and proxy them with mcrouter! 17 | 18 | 19 | ``` 20 | $ sudo docker run --name memcached0 -d -p 11211 sylvainlasnier/memcached 21 | $ sudo docker run --name memcached1 -d -p 11211 sylvainlasnier/memcached 22 | $ sudo docker inspect -f "{{.NetworkSettings.IPAddress}}" memcached0 23 | 24 | 172.17.0.2 25 | 26 | $ sudo docker inspect -f "{{.NetworkSettings.IPAddress}}" memcached1 27 | 28 | 172.17.0.3 29 | 30 | $ sudo docker run -d -p 5000:5000 jamescarr/mcrouter:1.0 mcrouter 31 | --config-str='{"pools":{"A":{"servers":["172.17.0.2:11211", "172.17.0.3:11211"]}}, 32 | "route":"PoolRoute|A"}' 33 | -p 5000 34 | 35 | ``` 36 | 37 | Now we can use mcrouter as a regular memcache server! 38 | 39 | ``` 40 | agrant@vagrant-ubuntu-trusty-64:~/mcrouter$ telnet localhost 5000 41 | Trying 127.0.0.1... 42 | Connected to localhost. 43 | Escape character is '^]'. 44 | stats 45 | STAT version mcrouter 1.0 46 | STAT commandargs --config-str={"pools":{"A":{"servers":["172.17.0.2:11211", "172.17.0.3:11211"]}}, 47 | "route":"PoolRoute|A"} -p 5000 48 | STAT child_pid 1 49 | STAT parent_pid 0 50 | STAT time 1410967072 51 | STAT uptime 276 52 | STAT num_servers 2 53 | STAT num_servers_up 0 54 | STAT num_servers_down 2 55 | STAT num_clients 0 56 | STAT server_up_events 0 57 | STAT server_down_events 0 58 | STAT closed_inactive_connections 0 59 | STAT mcc_txbuf_reqs 0 60 | STAT mcc_waiting_replies 0 61 | STAT asynclog_requests 0 62 | STAT sum_server_queue_length 0 63 | STAT proxy_reqs_processing 1 64 | STAT proxy_reqs_waiting 0 65 | STAT rusage_system 0.162521 66 | STAT rusage_user 0.103771 67 | STAT ps_num_minor_faults 4159 68 | STAT ps_num_major_faults 161 69 | STAT ps_user_time_sec 0.1 70 | STAT ps_system_time_sec 0.16 71 | STAT ps_vsize 315949056 72 | STAT ps_rss 13934592 73 | STAT ps_open_fd 0 74 | STAT fibers_allocated 0 75 | STAT fibers_pool_size 0 76 | STAT fibers_stack_high_watermark 0 77 | STAT successful_client_connections 2 78 | STAT duration_us 0 79 | STAT cmd_delete_count 0 80 | STAT cmd_get_count 0 81 | STAT cmd_set_count 0 82 | STAT cmd_delete_outlier_count 0 83 | STAT cmd_delete_outlier_failover_count 0 84 | STAT cmd_delete_outlier_shadow_count 0 85 | STAT cmd_delete_outlier_all_count 0 86 | STAT cmd_get_outlier_count 0 87 | STAT cmd_get_outlier_failover_count 0 88 | STAT cmd_get_outlier_shadow_count 0 89 | STAT cmd_get_outlier_all_count 0 90 | STAT cmd_set_outlier_count 0 91 | STAT cmd_set_outlier_failover_count 0 92 | STAT cmd_set_outlier_shadow_count 0 93 | STAT cmd_set_outlier_all_count 0 94 | STAT cmd_other_outlier_count 0 95 | STAT cmd_other_outlier_failover_count 0 96 | STAT cmd_other_outlier_shadow_count 0 97 | STAT cmd_other_outlier_all_count 0 98 | STAT cmd_delete 0 99 | STAT cmd_get 0 100 | STAT cmd_set 0 101 | STAT cmd_delete_outlier 0 102 | STAT cmd_delete_outlier_failover 0 103 | STAT cmd_delete_outlier_shadow 0 104 | STAT cmd_delete_outlier_all 0 105 | STAT cmd_get_outlier 0 106 | STAT cmd_get_outlier_failover 0 107 | STAT cmd_get_outlier_shadow 0 108 | STAT cmd_get_outlier_all 0 109 | STAT cmd_set_outlier 0 110 | STAT cmd_set_outlier_failover 0 111 | STAT cmd_set_outlier_shadow 0 112 | STAT cmd_set_outlier_all 0 113 | STAT cmd_other_outlier 0 114 | STAT cmd_other_outlier_failover 0 115 | STAT cmd_other_outlier_shadow 0 116 | STAT cmd_other_outlier_all 0 117 | END 118 | 119 | ``` 120 | 121 | ## Wish List 122 | 123 | Here's somethings that would be nice to add if possible! 124 | 125 | - etcd support 126 | - more fine grained configuration options 127 | - easy access to debug commands 128 | 129 | --------------------------------------------------------------------------------