Simplified service management using SMF
SMF, or Service Management Framework, is the Opensolaris replacement for init.d scripts. Services need to be run by a system, and SMF does this intelligently.
Traditionally, we've used /etc/init.d method of service management, where the services are started upon init depending on the init state. The scripts in the rc.d directory are run one after the other, and care must be taken to place the important core services are listed before the others that depend on it.
Like apt, SMF services are maintained as a tree of dependencies. The ssh service, for example, has network/physical as its dependency. There would be no use of running the the ssh service without the network services. Thus, any SMF service when started, first starts all its dependencies, and then itself. Starting/stopping a service is as simple as
svcadm enable ssh
svcadm disable ssh
This allows for very easy administration of services. In the above example, you dont have to worry about starting its dependencies first: SMF will take care of it. If one of the dependencies failed (eg: due to a disk failure), this is reported to the system via the Fault Management Architecture (FMA).
Another advantage of SMF is the speed of service startups upon bootup. Traditional /etc/init.d starts services one after the other depending on their numbering in the rc.d directory. But this is not efficient as a slow service wastes CPU time. SMF, with its knowledge of dependencies, will start 2 independent parts of the tree in parallel. This the CPU is optimally used, and leads to faster system bootup and services startup
More information on the Opensolaris SMF and FMA technologies, with comparison of equivalent /etc/init.f commands can be gleaned at the Sun documentation [6]
Dtrace: Probe the nervous system
Dtrace is another unique and powerful technology present in Nexenta. It provides a developer with a "read-only" interface into each and every function of the operating system. Set breakpoints (or probes) and run your script as and when they're fired. And it is not just limited to the kernel. More and more packages are adding Dtrace probes, allowing you to easily process the function call paths in the application, and collecting various statistics about the running system/application.
For example, the AMP stack have probes enabled in them[7]. This allows you easily monitor your web services and applications, and tune them as necessary. Using tcpdump and snoop to look at the network traffic? Why not a line in Dtrace?[8]
dtrace -qn 'ip:ip:*:receive{ printf("Packet recieved from %s: %d byte packetn", args[2]->ip_saddr, args[4]->ipv4_length ); }
Take a look at hundreds of other one-liners. Dtrace has a full fledged scripting language, which is similar to C. Many Dtrace resources are linked from here. Take a look at screencasts introducing Dtrace.
Example: Setting up a Webserver
If you have prior experience with setting up a webserver with Debian or Ubuntu, then you've already learnt setting one up on Nexenta.
First, download apache2, mysql and php
apt-get install apache2 mysql php5
Now setup the configuration files as required. they'll be available at /etc/apache2/httpd.conf
Once done, restart apache to update the configuration changes using
apache2ctl restart
and your webserver is up and running. Content goes under /var/www
Example: Setting up a CIFS server
CIFS is a protocol that allows for request of files and services over the network. It is the default file sharing service in Windows, and has been implemented by projects like Samba.
Nexenta makes it very easy via the ZFS filesystem to setup a file server.
First let us enable the SMF service, and setup the domain in which the server belongs (let us assume the domain is win.nexenta.org)
#svcadm enable -r smb/server
#smbadm join -u Administrator win.nexenta.org
Now, lets setup the ZFS to export a particular dataset
#zfs set sharesmb=on data/myshare
#zfs set sharesmb=name=myshare data/myshare
You might also want to set the case sensitivity of files if accessing from other windows boxes.
#zfs set casesensitivity=mixed data/myshare
Restart the smb/server and we're done.
#svcadm restart smb/server
For a complete step by step procedure take a look at the article here[9].
Give it a try!
Nexenta is available at www.nexenta.org. The developer community meets via IRC on #nexenta@freenode or the web interface at http://www.nexenta.org/chat. We're currently porting packages from Ubuntu's hardy repository to NexentaCore.
Join in here and request for a login to our build machines to test Nexenta live, and try out the devzone environments.
References
[0] http://www.nexenta.org/os/apt-clone[1] http://blogs.sun.com/bonwick/entry/raid_z
[2] http://www.unixconsult.org/zfs_vs_lvm.html
[3] http://docs.sun.com/app/docs/doc/819-2240/zpool-1m
[4] http://docs.sun.com/app/docs/doc/819-2240/zfs-1m
[5] http://www.gulecha.org/2008/08/22/getting-started-with-nexenta-development-part-2/
[6] http://www.sun.com/bigadmin/content/selfheal/SMF-quickstart.jsp
[7] http://blogs.sun.com/angelo/entry/dtrace_meet_the_amp_apache
[8] http://www.cuddletech.com/blog/pivot/entry.php?id=952
[9] http://jmlittle.blogspot.com/2008/03/step-by-step-cifs-server-setup-with.html
About the author:
Anil Gulecha is Nexenta developer. He maintains a blog at gulecha.org. He tries to play a little guitar in his free time.
- Nexenta, Page 1
- Nexenta, Page 2



