forked from Netflix/dynomite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: src/dyn_stats.c src/dyn_stats.h
- Loading branch information
Showing
75 changed files
with
5,467 additions
and
3,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
dyn_o_mite: | ||
datacenter: dc | ||
rack: rack1 | ||
dyn_listen: 0.0.0.0:8101 | ||
dyn_seed_provider: florida_provider | ||
listen: 0.0.0.0:8102 | ||
servers: | ||
rack: rack1 | ||
dyn_listen: 0.0.0.0:8101 | ||
dyn_seed_provider: florida_provider | ||
listen: 0.0.0.0:8102 | ||
servers: | ||
- 127.0.0.1:6379:1 | ||
tokens: '0' | ||
secure_server_option: datacenter | ||
pem_key_file: conf/dynomite.pem | ||
data_store: 0 | ||
tokens: '0' | ||
secure_server_option: datacenter | ||
pem_key_file: conf/dynomite.pem | ||
data_store: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,21 @@ | ||
# Add support for m4_esyscmd_s to autoconf-2.63 (used in RHEL/CentOS 6.7) | ||
m4_ifndef([m4_esyscmd_s], [m4_define([m4_chomp_all], [m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [/], [/ ]), [/*$]), [$1])])]) | ||
m4_ifndef([m4_esyscmd_s], [m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])]) | ||
|
||
# Define the package version numbers and the bug reporting address | ||
m4_define([DN_MAJOR], 0) | ||
m4_define([DN_MINOR], 5) | ||
m4_define([DN_PATCH], 6) | ||
m4_define([DN_BUGS], [[email protected]]) | ||
m4_define([DN_VERSION_STRING], m4_esyscmd_s([git describe --dirty --always --tags])) | ||
|
||
# Initialize autoconf | ||
AC_PREREQ([2.63]) | ||
<<<<<<< .merge_file_a7S2ED | ||
AC_INIT([dynomite], [DN_MAJOR.DN_MINOR.DN_PATCH], [DN_BUGS]) | ||
======= | ||
AC_INIT([dynomite], [DN_VERSION_STRING], [DN_BUGS]) | ||
>>>>>>> .merge_file_YwhkOZ | ||
AC_CONFIG_SRCDIR([src/dynomite.c]) | ||
AC_CONFIG_AUX_DIR([config]) | ||
AC_CONFIG_HEADERS([config.h:config.h.in]) | ||
|
@@ -211,7 +220,12 @@ AC_CONFIG_FILES([Makefile | |
src/hashkit/Makefile | ||
src/proto/Makefile | ||
src/seedsprovider/Makefile | ||
<<<<<<< .merge_file_a7S2ED | ||
src/event/Makefile]) | ||
======= | ||
src/event/Makefile | ||
src/tools/Makefile]) | ||
>>>>>>> .merge_file_YwhkOZ | ||
|
||
# Generate the "configure" script | ||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Florida | ||
|
||
## Florida Multi-Cluster Solution | ||
|
||
Let's say you want to have multiple clusters so you need to have different Florida URLs providing different seeds for each cluster. In such a case, the following environment variables can be used to customize the behavior of Dynomite without requiring a custom build (via Make). | ||
|
||
- `DYNOMITE_FLORIDA_IP` | ||
- `DYNOMITE_FLORIDA_PORT` | ||
- `DYNOMITE_FLORIDA_REQUEST` | ||
|
||
The Florida server only reads the environment variables one time when the server is started. If the environment variables are not present (NULL) the code will use the macros or CFLAGS values. This is great because it allows us to use the same binary all the time, and then later when I deploy the code into ASGARD I can have just different user data since is just a matter of export different values to the AMI/Linux. There is a minor FIX of YAML syntax as well. | ||
|
||
So for instance someone can have in the `/etc/profile` | ||
|
||
```bash | ||
export DYNOMITE_FLORIDA_PORT=8080 | ||
export DYNOMITE_FLORIDA_IP="127.0.0.1" | ||
export DYNOMITE_FLORIDA_REQUEST="GET /florida/cluster1/get_seeds.txt HTTP/1.0 | ||
Host: 127.0.0.1 | ||
User-Agent: HTMLGET 1.0 | ||
" | ||
``` | ||
|
||
and for another box just | ||
|
||
```bash | ||
export DYNOMITE_FLORIDA_PORT=8080 | ||
export DYNOMITE_FLORIDA_IP="127.0.0.1" | ||
export DYNOMITE_FLORIDA_REQUEST="GET /florida/cluster2/get_seeds.txt HTTP/1.0 | ||
Host: 127.0.0.1 | ||
User-Agent: HTMLGET 1.0 | ||
" | ||
``` | ||
|
||
Even pass this through ASGARD via user_data. | ||
|
||
Then build dynomite normally like: | ||
|
||
```bash | ||
sudo autoreconf -fvi ; sudo ./configure --enable-debug=log ; sudo make; | ||
``` | ||
|
||
And Run: | ||
|
||
```bash | ||
sudo --preserve-env src/dynomite -c conf/dynomite_florida_single.yml | ||
``` | ||
|
||
And it works :-) | ||
|
||
## florida.js | ||
|
||
`florida.js` is an http server that returns a list of seed nodes via a REST API. | ||
|
||
### Command | ||
|
||
```bash | ||
node florida.js [file] [debug] | ||
``` | ||
|
||
**file** must be a path to a `seeds.list` file. The default `seeds.list` file is `/etc/dynomite/seeds.list`. | ||
|
||
**debug** is written as the string "debug" (without the quotes). | ||
|
||
### Run in debug mode | ||
|
||
You can run `florida.js` in debug mode (i.e. with messages logged to the console) with the following command. | ||
|
||
```bash | ||
cd scripts/Florida | ||
|
||
npm run debug | ||
``` | ||
|
||
### Run with a custom seeds file | ||
|
||
```bash | ||
cd scripts/Florida | ||
|
||
node florida.js ./seeds.list | ||
``` | ||
|
||
### Run with a custom seeds file in debug mode | ||
|
||
```bash | ||
cd scripts/Florida | ||
|
||
node florida.js ./seeds.list debug | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# README | ||
|
||
The `init` directory is the location for all System V init, Upstart, systemd, etc. initialization scripts. | ||
|
||
## systemd on RHEL 7 | ||
|
||
Create the `dynomite` user. | ||
|
||
```bash | ||
mkdir -p /usr/share/dynomite | ||
|
||
mkdir /var/run/dynomite | ||
|
||
useradd -r -M -c "Dynomite server" -s /sbin/nologin -d /usr/share/dynomite dynomite | ||
|
||
chown -R dynomite:dynomite /usr/share/dynomite | ||
|
||
chown -R dynomite:dynomite /var/run/dynomite | ||
``` | ||
|
||
Install the Dynomite service file and the associated sysconfig file. | ||
|
||
```bash | ||
cp init/systemd_environment__dynomite /etc/sysconfig/dynomite | ||
|
||
cp init/systemd_service_rhel__dynomite.service /usr/lib/systemd/system/dynomite.service | ||
|
||
systemctl daemon-reload | ||
|
||
systemctl enable dynomite | ||
|
||
systemctl status dynomite | ||
``` | ||
|
||
## systemd on Ubuntu 15.10 | ||
|
||
Create the `dynomite` user. | ||
|
||
```bash | ||
mkdir -p /usr/share/dynomite | ||
|
||
mkdir /var/run/dynomite | ||
|
||
useradd -r -M -c "Dynomite server" -s /sbin/nologin -d /usr/share/dynomite dynomite | ||
|
||
chown -R dynomite:dynomite /usr/share/dynomite | ||
|
||
chown -R dynomite:dynomite /var/run/dynomite | ||
``` | ||
|
||
Install the Dynomite service file and the associated sysconfig file. | ||
|
||
```bash | ||
cp init/systemd_environment__dynomite /etc/default/dynomite | ||
|
||
cp init/systemd_service_ubuntu__dynomite.service /lib/systemd/system/dynomite.service | ||
|
||
systemctl daemon-reload | ||
|
||
systemctl enable dynomite | ||
|
||
systemctl status dynomite | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DYNOMITE_CONF=/etc/dynomite/dynomite.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
Description=Dynomite server | ||
; Services that should be started before Dynomite | ||
After=network.target nss-lookup.target time-sync.target | ||
Documentation=man:dynomite(8) | ||
|
||
[Service] | ||
User=dynomite | ||
; Default environment variable values | ||
Environment=DYNOMITE_CONF=/etc/dynomite/dynomite.yaml | ||
Type=forking | ||
; Environment vars to customize startup | ||
EnvironmentFile=-/etc/sysconfig/dynomite | ||
ExecStart=/usr/local/sbin/dynomite -d -c $DYNOMITE_CONF -p /var/run/dynomite/dynomite.pid | ||
; Restart dynomite every 100ms | ||
Restart=always | ||
PIDFile=/var/run/dynomite/dynomite.pid | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[Unit] | ||
Description=Dynomite server | ||
; Services that should be started before Dynomite | ||
After=network.target nss-lookup.target time-sync.target | ||
Documentation=man:dynomite(8) | ||
|
||
[Service] | ||
User=dynomite | ||
; Default environment variable values | ||
Environment=DYNOMITE_CONF=/etc/dynomite/dynomite.yaml | ||
Type=forking | ||
; Environment vars to customize startup | ||
EnvironmentFile=-/etc/default/dynomite | ||
ExecStart=/usr/local/sbin/dynomite -d -c $DYNOMITE_CONF -p /var/run/dynomite/dynomite.pid | ||
; Restart dynomite every 100ms | ||
Restart=always | ||
PIDFile=/var/run/dynomite/dynomite.pid | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
Oops, something went wrong.