27_code-in-process/67_digital-ocean_aerospike/README.md
ssh root@<ip_address>ssh root@<ip_address> command
adduser <username>gpasswd -a <username> sudosu <username>cdmkdir .sshchmod 700 .sshnano .ssh/authorized_keyschmod 600 .ssh/authorized_keysexitssh <username>@<ip_address>nano /etc/ssh/sshd_configPermitRootLogin to no to disable root login.PasswordAuthentication to no to disable logging in with a password.
service ssh restartsudo ufw allow sshsudo ufw allow 22/tcpsudo ufw show addedsudo ufw enablesudo ufw statussudo dpkg-reconfigure tzdatasudo apt-get update
sudo apt-get install ntpsudo fallocate -l <size> /swapfile<size> is something like 1G or 512M
sudo chmod 600 /swapfilesudo mkswap /swapfilesudo swapon /swapfilesudo sh -c 'echo "/swapfile none swap sw 0 0" >> /etc/fstab'sudo poweroffwget <url>https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gzwget https://storage.googleapis.com/golang/go1.5.1.linux-amd64.tar.gztar -xzf <filename>
sudo mv go /usr/local/gosudo chown -R root:root /usr/local/gosudo chmod 755 /usr/local/gomkdir <workspace_name>{,/bin,/pkg,/src}
mkdir goworkspace{,/bin,/pkg,/src}sudo nano /etc/profile
export PATH=$PATH:/usr/local/go/bin to /etc/profile fileexport GOPATH=$HOME/<workspace_name> to ~/.profile fileexport PATH=$HOME/<workspace_name>/bin:$PATH to ~/.profilerm <filename>
rm go1.5.1.linux-amd64.tar.gzsudo apt-get install gitsudo ufw allow httpsudo ufw allow 80/tcpsudo ufw allow httpssudo ufw allow 443/tcpsudo ufw statussudo apt-get install haproxy/etc/haproxy/haproxy.cfg with sudo nano
sudo nano /etc/haproxy/haproxy.cfgretries 3option redispatchlisten app 0.0.0.0:80
mode http
option http-server-close
timeout http-keep-alive 3000
server serv 127.0.0.1:9000 check
* More information available [here](https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-http-load-balancing-on-an-ubuntu-vps).
sudo service haproxy reloadscp <source> <destination>
scp -rp <source> <destination><username>@<ip_address>:<path>
scp -rp ~/Desktop/testServer [email protected]:~/testServerscp -rp 01_helloWorld/ [email protected]:~/01_helloWorldsudo nano /etc/systemd/system/<filename>.service
sudo nano /etc/systemd/system/serveityo.service[Unit] Description=Go Server
[Service] ExecStart=/home/<username>/<exepath> WorkingDirectory=/home/<username>/<exefolderpath> User=<username> Group=<username> Restart=always
[Install] WantedBy=multi-user.target ```
* eg,
```
[Unit] Description=Go Server
[Service] ExecStart=/home/todd/01_helloWorld/01_helloWorld WorkingDirectory=/home/todd/01_helloWorld User=todd Group=todd Restart=always
[Install] WantedBy=multi-user.target ```
* Add the service to systemd.
* `sudo systemctl enable <filename>.service`
* eg, `sudo systemctl enable serveityo.service`
* Activate the service.
* `sudo systemctl start <filename>.service`
* eg, `sudo systemctl start serveityo.service`
* Check if systemd started it.
* `sudo systemctl status <filename>.service`
* eg, `sudo systemctl status serveityo.service`
* if you get this ERROR:
* Failed to start Go Server.
* make sure you build your file:
* go build
* More information about systemd commands can be found [here](http://www.linux.com/learn/tutorials/788613-understanding-and-using-systemd/).
* Check if the server is running with your web-browser, just use the server ip address as the url.
wget -O aerospike.tgz 'http://aerospike.com/download/server/latest/artifact/ubuntu12'tar -xvf aerospike.tgzcd aerospike-server-community-<enter your version here>-ubuntu12
cd aerospike-server-community-3.6.4-ubuntu12.04/sudo ./asinstallsudo ufw allow in on eth1 to any port 3000 proto tcpsudo service aerospike startsudo tail -f /var/log/aerospike/aerospike.log | grep cake
sudo apt-get install python gcc python-devwget -O amc.deb http://www.aerospike.com/download/amc/latest/artifact/ubuntu12sudo dpkg -i amc.debsudo ufw allow 8081/tcpsudo /etc/init.d/amc start<server_ip>:8081
192.241.219.56:8081127.0.0.1rm amc.debsudo nano /etc/aerospike/aerospike.confsudo service aerospike restartgo get github.com/aerospike/aerospike-client-gocd $GOPATH/src/github.com/aerospike/aerospike-client-go/tools/benchmark
* Run the tool.go run benchmark.go -h <ip_address>
go run benchmark.go -h 127.0.0.1ifconfig | grep "inet addr", the middle address should be the private one.