Add solana-fullnode-config

This commit is contained in:
Greg Fitzgerald
2018-05-31 15:45:03 -06:00
parent 359a8397c0
commit 4b8c36b6b9
5 changed files with 73 additions and 14 deletions

View File

@ -20,6 +20,10 @@ path = "src/bin/client-demo.rs"
name = "solana-fullnode" name = "solana-fullnode"
path = "src/bin/fullnode.rs" path = "src/bin/fullnode.rs"
[[bin]]
name = "solana-fullnode-config"
path = "src/bin/fullnode-config.rs"
[[bin]] [[bin]]
name = "solana-genesis" name = "solana-genesis"
path = "src/bin/genesis.rs" path = "src/bin/genesis.rs"

View File

@ -47,15 +47,25 @@ $ echo 1000000000 | cargo run --release --bin solana-mint-demo > mint-demo.json
$ cat mint-demo.json | cargo run --release --bin solana-genesis-demo > genesis.log $ cat mint-demo.json | cargo run --release --bin solana-genesis-demo > genesis.log
``` ```
Before you start the server, make sure you know the IP address of the machine ou want to be the leader for the demo, and make sure that udp ports 8000-10000 are open on all the machines you want to test with. Running this command the first time will generate an identity for the leader `leader.json`. Now you can start the server: Before you start the server, make sure you know the IP address of the machine you
want to be the leader for the demo, and make sure that udp ports 8000-10000 are
open on all the machines you want to test with.
Generate a leader configuration file with:
```bash
cargo run --release --bin solana-fullnode-config > leader.json
```
Now start the server:
```bash ```bash
$ cat ./multinode-demo/leader.sh $ cat ./multinode-demo/leader.sh
#!/bin/bash #!/bin/bash
export RUST_LOG=solana=info export RUST_LOG=solana=info
sudo sysctl -w net.core.rmem_max=26214400 sudo sysctl -w net.core.rmem_max=26214400
cat genesis.log | cargo run --release --bin solana-fullnode -- -s leader.json -l leader.json -b 8000 -d 2>&1 | tee leader-tee.log cat genesis.log | cargo run --release --bin solana-fullnode -- -l leader.json
$ ./multinode-demo/leader.sh $ ./multinode-demo/leader.sh > leader-txs.log
``` ```
Wait a few seconds for the server to initialize. It will print "Ready." when it's safe Wait a few seconds for the server to initialize. It will print "Ready." when it's safe
@ -71,8 +81,8 @@ rsync -v -e ssh $1/leader.json .
rsync -v -e ssh $1/genesis.log . rsync -v -e ssh $1/genesis.log .
export RUST_LOG=solana=info export RUST_LOG=solana=info
sudo sysctl -w net.core.rmem_max=26214400 sudo sysctl -w net.core.rmem_max=26214400
cat genesis.log | cargo run --release --bin solana-fullnode -- -l validator.json -s validator.json -v leader.json -b 9000 -d 2>&1 | tee validator-tee.log cat genesis.log | cargo run --release --bin solana-fullnode -- -l validator.json -v leader.json -b 9000 -d
$ ./multinode-demo/validator.sh ubuntu@10.0.1.51:~/solana #The leader machine $ ./multinode-demo/validator.sh ubuntu@10.0.1.51:~/solana > validator-txs.log #The leader machine
``` ```
@ -164,7 +174,7 @@ $ cargo +nightly bench --features="unstable"
To run the benchmarks on Linux with GPU optimizations enabled: To run the benchmarks on Linux with GPU optimizations enabled:
```bash ```bash
$ wget https://solana-build-artifacts.s3.amazonaws.com/v0.5.0/libcuda_verify_ed25519.a $ wget https://solana-build-artifacts.s3.amazonaws.com/v0.6.0/libcuda_verify_ed25519.a
$ cargo +nightly bench --features="unstable,cuda" $ cargo +nightly bench --features="unstable,cuda"
``` ```

View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
export RUST_LOG=solana=info export RUST_LOG=solana=info
sudo sysctl -w net.core.rmem_max=26214400 sudo sysctl -w net.core.rmem_max=26214400
rm -f leader.log cat genesis.log | cargo run --bin solana-fullnode -- -l leader.json
cat genesis.log | cargo run --features=cuda --bin solana-fullnode -- -s leader.json -l leader.json -b 8000 -d 2>&1 | tee leader-tee.log

View File

@ -0,0 +1,52 @@
extern crate getopts;
extern crate serde_json;
extern crate solana;
use getopts::Options;
use solana::crdt::{get_ip_addr, parse_port_or_addr, ReplicatedData};
use std::env;
use std::io;
use std::net::SocketAddr;
use std::process::exit;
fn print_usage(program: &str, opts: Options) {
let mut brief = format!("Usage: {} [options]\n\n", program);
brief += " Create a solana fullnode config file\n";
print!("{}", opts.usage(&brief));
}
fn main() {
let mut opts = Options::new();
opts.optopt("b", "", "bind", "bind to port or address");
opts.optflag("d", "dyn", "detect network address dynamically");
opts.optflag("h", "help", "print help");
let args: Vec<String> = env::args().collect();
let matches = match opts.parse(&args[1..]) {
Ok(m) => m,
Err(e) => {
eprintln!("{}", e);
exit(1);
}
};
if matches.opt_present("h") {
let program = args[0].clone();
print_usage(&program, opts);
return;
}
let bind_addr: SocketAddr = {
let mut bind_addr = parse_port_or_addr(matches.opt_str("b"));
if matches.opt_present("d") {
let ip = get_ip_addr().unwrap();
bind_addr.set_ip(ip);
}
bind_addr
};
// we need all the receiving sockets to be bound within the expected
// port range that we open on aws
let repl_data = ReplicatedData::new_leader(&bind_addr);
let stdout = io::stdout();
serde_json::to_writer(stdout, &repl_data).expect("serialize");
}

View File

@ -37,7 +37,6 @@ fn main() {
let mut opts = Options::new(); let mut opts = Options::new();
opts.optopt("b", "", "bind", "bind to port or address"); opts.optopt("b", "", "bind", "bind to port or address");
opts.optflag("d", "dyn", "detect network address dynamically"); opts.optflag("d", "dyn", "detect network address dynamically");
opts.optopt("s", "", "save", "save my identity to path.json");
opts.optopt("l", "", "load", "load my identity to path.json"); opts.optopt("l", "", "load", "load my identity to path.json");
opts.optflag("h", "help", "print help"); opts.optflag("h", "help", "print help");
opts.optopt( opts.optopt(
@ -164,11 +163,6 @@ fn main() {
); );
server.thread_hdls server.thread_hdls
}; };
if matches.opt_present("s") {
let path = matches.opt_str("s").unwrap();
let file = File::create(path).expect("file");
serde_json::to_writer(file, &repl_data).expect("serialize");
}
eprintln!("Ready. Listening on {}", repl_data.transactions_addr); eprintln!("Ready. Listening on {}", repl_data.transactions_addr);
for t in threads { for t in threads {