vbox host vboxnet0 = 192.168.56.1 (static, no dhcp)
vbox smartos guest config:
storage:
- add ISO
audio:
- disable
network:
- adapter 1: host-only, promiscuous (intel pro/1000 mt desktop, vboxnet0), NOTE mac address
- adapter 2: nat
At http://wiki.smartos.org/display/DOC/Download+SmartOS you can download the latest SmartOS ISO. Mount this image in VirtualBox and start an Oracle Solaris 11 (64 bit) installation.
Would you like to continue with configuration? [Y/n] Enter Enter the number of the NIC for the 'admin' interface: 1 IP address (or 'dhcp'): 192.168.56.2 netmask: 255.255.255.0 Enter the default gateway IP: dhcp Enter the Primary DNS server IP [8.8.8.8]: Enter Enter the Secondary DNS server IP [8.8.4.4]: Enter Enter the domain name: local Default DNS search domain: local Valid choices are c0t0d0 c0t0d0 Choose a root password: Confirm password: Is this correct? [y]: Enter Would you like to edit the final configuration file? [n]: Enter ********************************************* * This will erase *ALL DATA* on these disks * ********************************************* are you sure? [n]: y
login and add the following keys to /usbkey/config:
add:
- external_nic=8:0:27:8d:b5:a5
- external0_ip=dhcp
- external0_gateway=dhcp
- root_authorized_keys_file=authorized_keys
remove:
- admin_gateway=192.168.56.2
- headnode_default_gateway=dhcp
This enables authorized_keys and internet access via the nat adapter.
$ ssh [email protected] Last login: Tue May 27 21:31:36 2014 from 192.168.56.1 - SmartOS Live Image v0.147+ build: 20140515T211957Z [root@08-00-27-28-63-86 ~]# cat /usbkey/config # # This file was auto-generated and must be source-able by bash. # # admin_nic is the nic admin_ip will be connected to for headnode zones. admin_nic=8:0:27:28:63:86 admin_ip=192.168.56.2 admin_netmask=255.255.255.0 admin_network=... external_nic=8:0:27:8d:b5:a5 external0_ip=dhcp external0_gateway=dhcp dns_resolvers=8.8.8.8,8.8.4.4 dns_domain=local ntp_hosts=pool.ntp.org compute_node_ntp_hosts=192.168.56.2 root_authorized_keys_file=authorized_keys
add public key for password-less login
[root@08-00-27-28-63-86 ~]# mkdir /usbkey/config.inc [root@08-00-27-28-63-86 ~]# vi /usbkey/config.inc/authorized_keys
reboot to enable authorized_keys and second network interface
[root@08-00-27-28-63-86 ~]# ifconfig lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 e1000g0: flags=1000943 mtu 1500 index 2 inet 192.168.56.2 netmask ffffff00 broadcast 192.168.56.255 ether 8:0:27:28:63:86 external0: flags=1004843 mtu 1500 index 3 inet 10.0.3.15 netmask ffffff00 broadcast 10.0.3.255 ether 2:8:20:cb:d9:cc lo0: flags=2002000849 mtu 8252 index 1 inet6 ::1/128
list images
[root@08-00-27-28-63-86 ~]# imgadm avail ... d05983cc-db7e-11e3-97fc-539ccfe9fa95 mongodb 14.1.0 smartos 2014-05-14T15:45:45Z 45ad5854-db8b-11e3-8f4c-0bc011b22b7d nodejs 14.1.0 smartos 2014-05-14T17:14:55Z e65e0c4c-dc4b-11e3-b843-93672a0b57d8 cassandra 14.1.0 smartos 2014-05-15T16:13:49Z bb41287c-e02a-11e3-aa6b-db678b82f5fc java 14.1.0 smartos 2014-05-20T14:26:27Z
download mongodb image (which contains nodejs)
[root@08-00-27-28-63-86 ~]# imgadm import d05983cc-db7e-11e3-97fc-539ccfe9fa95
create a file /zones/zone.json that contains the following data:
{ "brand": "joyent", "dataset_uuid": "d05983cc-db7e-11e3-97fc-539ccfe9fa95", "max_physical_memory": 1024, "resolvers": [ "8.8.8.8", "8.8.4.4" ], "default-gateway": "dhcp", "nics": [ { "nic_tag": "admin", "ip": "192.168.56.3", "netmask": "255.255.255.0" }, { "nic_tag": "external", "ip": "dhcp", "gateway": "dhcp" } ] }
use this file to create the zone
[root@08-00-27-28-63-86 ~]# vmadm create -f /zones/zone.json Successfully created VM 97d19303-e9b7-4317-9fc0-fddaf3cd8ec4
login to the zone and install the public key in ~/.ssh/authorized_keys
[root@08-00-27-28-63-86 ~]# zlogin 97d19303-e9b7-4317-9fc0-fddaf3cd8ec4 [Connected to zone '97d19303-e9b7-4317-9fc0-fddaf3cd8ec4' pts/3] __ . . _| |_ | .-. . . .-. :--. |- |_ _| ;| || |(.-' | | | |__| `--' `-' `;-| `-' ' ' `-' / ; Instance (mongodb 14.1.0) `-' http://wiki.joyent.com/jpc2/MongoDB+Instance [root@8fe9b8fe-e8cc-483d-b7d0-e307d03a39e0 ~]# vi .ssh/authorized_keys
ifconfig
[root@8fe9b8fe-e8cc-483d-b7d0-e307d03a39e0 ~]# ifconfig lo0: flags=2001000849 mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 net0: flags=40001000843 mtu 1500 index 2 inet 192.168.56.3 netmask ffffff00 broadcast 192.168.56.255 ether b2:fb:6b:b1:7d:6c net1: flags=1004843 mtu 1500 index 3 inet 10.0.3.19 netmask ffffff00 broadcast 10.0.3.255 ether 22:77:10:67:2b:24 lo0: flags=2002000849 mtu 8252 index 1 inet6 ::1/128
routing table
[root@bbf6a33a-ffc6-4906-a621-73102976f8b3 ~]# netstat -r Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ---------- --------- 10.0.3.0 10.0.3.17 U 3 0 net1 localhost localhost UH 2 0 lo0 192.168.56.0 192.168.56.3 U 3 424 net0 Routing Table: IPv6 Destination/Mask Gateway Flags Ref Use If --------------------------- --------------------------- ----- --- ------- ----- localhost localhost UH 2 0 lo0
from http://blog.nodejs.org/2012/04/25/profiling-node-js/
optionally install c and c++ compilers
[root@bbf6a33a-ffc6-4906-a621-73102976f8b3 ~]# pkgin in gcc48
install stackvis
[root@bbf6a33a-ffc6-4906-a621-73102976f8b3 ~]# npm install -g stackvis
Run the node program to profile + the following dtrace command simultaneously:
[root@bbf6a33a-ffc6-4906-a621-73102976f8b3 ~]# dtrace -n 'profile-97/execname == "node" && arg1/{ @[jstack(150, 8000)] = count(); } tick-10s { exit(0); }' | stackvis dtrace flamegraph-svg > stacks.svg