Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Joshua Sierles jsierles

🎯
Focusing
Block or report user

Report or block jsierles

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:9187108
Requests are distributed according to the servers in round-robin manner with respect of the server weight.
For example of every seven requests given above they will be distributed like this: 5 requests on backend1.example.com and one request to the second and the third of server. If with an attempt at the work with the server error occurred, then the request will be transmitted to the following server and then until all workers of server not are tested. If successful answer is not succeeded in obtaining from all servers, then to client will be returned the result of work with the last server.
Nginx distributes requests round-robin, factoring in the server weight value.
For example, for a total of 7 requests, the distribution is: 5 requests to backend1.example.com, and one request each to the other two servers. If the server returns an error, nginx will retry the request on the next server in the list. Should all servers return errors, the client receives the response from the last server.
View gist:9212141
ssh -vvv \
-o PasswordAuthentication=yes \
-o ChallengeResponseAuthentication=no \
-o GSSAPIAuthentication=no \
-o HostbasedAuthentication=no \
-o PubkeyAuthentication=no \
-o RSAAuthentication=no \
-o Compression=no \
-o ForwardAgent=no \
-o ForwardX11=no \
View gist:9508559
Internal Server Error
The server encountered an error while processing this request:
[{webmachine_util,media_type_match,2,
[{file,"src/webmachine_util.erl"},{line,174}]},
{webmachine_util,'-media_match/2-lc$^0/1-0-',3,
[{file,"src/webmachine_util.erl"},{line,163}]},
{webmachine_util,choose_media_type1,2,
[{file,"src/webmachine_util.erl"},{line,154}]},
{webmachine_decision_core,decision,1,
View gist:747cad4b6e6cd6eeba06
net.core.somaxconn = 32768
net.ipv4.conf.all.send_redirects = 1
net.ipv4.ip_nonlocal_bind = 1
net.ipv4.tcp_abort_on_overflow = 0
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 262144
net.ipv4.tcp_mem = 200000    280000    300000
@jsierles
jsierles / gist:fa20f9f021d84315614b
Created May 22, 2014
Tuning parameters for load balancer
View gist:fa20f9f021d84315614b
# max number of TCP SYN requests allowed per call to listen()
net.core.somaxconn = 32768
# allow listening on virtual IPs
net.ipv4.ip_nonlocal_bind = 1
# these values are documented in the 'tcp' man page: http://man7.org/linux/man-pages/man7/tcp.7.html
# see also http://kaivanov.blogspot.com.es/2010/09/linux-tcp-tuning.html
# number of seconds idle on a connection before sending a TCP keepalive probe
View gist:0cb9f6a80c8c7a13ad2e
ROM cenx/centos:6.5
RUN rpm -i http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
RUN yum install -y postgresql93-server postgresql93-contrib
RUN mkdir /var/run/postgresql
RUN chown postgres:postgres /var/run/postgresql
View gist:b2a903739a731679ea46
[root@vagrant-centos65 database]# docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
cenx/postgresql 9.3.4-0 56fa1e4ae460 About an hour ago 660 MB
cenx/centos 6.5 56019f161f24 About an hour ago 487 MB
tianon/centos 6.5 89b52f216c6c 3 months ago 149.3 MB
[root@vagrant-centos65 database]# docker run tianon/centos
Unable to find image 'tianon/centos' locally
Pulling repository tianon/centos
0252ee3ea03b: Error pulling image (5.10) from tianon/centos, Driver devicemapper failed to create image rootfs 0252ee3ea03ba08da8d7fa9c92ae9826a4926f62d7aaaaa2b8c867f8e56449ac: device 0252ee3ea03ba08da8d7fa3086a074c4b6: Error pulling image (6.2) from tianon/centos, Driver devicemapper failed to create image rootfs 3086a074c4b644a0d649d4e554e25c178001ac58aef597def20c102f563a96e5: device 3086a074c4b644a0d649d4e554e25c178001ac58aef597def20c102f563a96e5 already exists 8001ac58aef597
View gist:fe28718b3e51f14cae69
/Users/joshua/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/docker-api-1.11.0/lib/docker/util.rb:11:in `rescue in parse_json': 757: unexpected token at '{"ID":"a4fa4caa15c3c1e9f856db0c2a9bb1adcc1f5121e53220f4b6adaa74d19a13a2","Created":"2014-06-03T11:47:11.911564454Z","Path":"/bin/sh","Args":["-c","/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg"],"Config":{"Hostname":"frontend","Domainname":"","User":"","Memory":0,"MemorySwap":0,"CpuShares":0,"AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"PortSpecs":null,"ExposedPorts":{"443/tcp":{},"80/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["HOME=/","PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg"],"Image":"myercer.localnet/frontend","Volumes":null,"WorkingDir":"","Entrypoint":null,"NetworkDisabled":false,"OnBuild":null},"State":{"Running":false,"Pid":0,"ExitCode":0,"StartedAt":"0001-01-01T00:00:00Z","FinishedAt":"0001-01-01T00:00:00Z"},"Image":"
View gist:d426a9c5a2f21fc78745
#!/bin/bash
{{range $key, $value := .}}
{{ with $address := index $value.Addresses 0 }}
# {{ $value.Name }}
curl -L http://127.0.0.1:4001/v2/keys/backends/{{ $value.Image.Repository}}/{{printf "%.*s" 12 $value.ID}} -XPUT -d value="{{ $address.IP }}:{{ $address.Port }}" -d ttl=15
{{ end }}
{{end}}
2014/06/03 10:36:55 template error: template: etcd.tmpl:4:20: executing "etcd.tmpl" at <index $value.Address...>: error calling index: index out of range: 0
View gist:7135002212d82327959c
Jun 04 15:14:28 sevilla systemd[1]: Starting etcd...
Jun 04 15:14:28 sevilla systemd[1]: Started etcd.
Jun 04 15:14:28 sevilla etcd[3162]: [etcd] Jun 4 15:14:28.180 INFO | Discovery via https://discovery.etcd.io using prefix /5670f29e5b514e25532b0dbef5deeb88.
Jun 04 15:14:29 sevilla etcd[3162]: [etcd] Jun 4 15:14:29.277 INFO | Discovery _state was empty, so this machine is the initial leader.
Jun 04 15:14:29 sevilla etcd[3162]: [etcd] Jun 4 15:14:29.277 INFO | 1611bff0bfd844029d22dcf153452e35: state changed from 'stopped' to 'follower'.
Jun 04 15:14:29 sevilla etcd[3162]: [etcd] Jun 4 15:14:29.278 INFO | 1611bff0bfd844029d22dcf153452e35: state changed from 'follower' to 'leader'.
Jun 04 15:14:29 sevilla etcd[3162]: [etcd] Jun 4 15:14:29.278 INFO | 1611bff0bfd844029d22dcf153452e35: leader changed from '' to '1611bff0bfd844029d22dcf153452e35'.
Jun 04 15:14:29 sevilla etcd[3162]: [etcd] Jun 4 15:14:29.308 INFO | etcd server [name 1611bff0bfd844029d22dcf153452e35, listen on [::
You can’t perform that action at this time.