cloud erlang

Post on 05-Dec-2014

3.114 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

You normally think of virtualization as virtualization at the operating system level. But with Erlang, you can do virtualization at application level.

TRANSCRIPT

Erlang:Bring cloud to your application

Ngoc Dao

Normally, you bring

your application → cloud

Erlang lets you bring

cloud → your application

Normally,cloud is at OS level

Erlang lets you create and controlcloud at application level,your application

It’s because Erlang feels like an OS

You can control the OS in your application

ps → pman:start().

top → etop:start().

applications → applicationsappmon:start().webtool:start().observer:start().

“We are dropping appmon, and replacing it with observer instead.”

observer:start().

webtool alternative: BigWig

debugger:start().

Let’s create a cloud

mynode1

Erlang processErlang processErlang process

mynode2

Erlang processErlang processErlang process

Guestmachine

Hostmachine

Guestmachine

Create 2 nodes

$ erl -sname mynode1 -setcookie mypassword1 -detached

$ erl -sname mynode2 -setcookie mypassword2 -detached

Check if the nodes are on

$ ps aux

[output]epmd -daemonbeam.smp ... -sname mynode1 -setcookie mypassword1 -noshell -noinputbeam.smp ... -sname mynode2 -setcookie mypassword2 -noshell -noinput

Guestmachine

Guestmachine

Hostmachine

epmd

mynode1

Erlang processErlang processErlang process

mynode2

Erlang processErlang processErlang process

Guestmachine

Hostmachine

Guestmachine

Login to mynode1

$ erl -sname mynode3 -setcookie mypassword1 -remsh mynode1@ngoc

From here, to stop mynode1: init:stop(). or q().

To quit without stoping mynode1:Ctrl+C

More topics

• Deploy code to nodes• Connect nodes together• Hot code swap

top related