To set up debugging on the slapd, in slapd.conf:
Continue readingCategory Archives: Networking
My Ideal Technology Setup for work
“Since I’m dreaming, I’d like a pony” –Susie, in Calvin and Hobbes.
“I’m not just the President of the Hair Club for Men, I’m also a client.” –President of the Hair Club for Men
Not only do I write software, I use it. A whole bunch. I am a Linux guy, and when ever I end up in a situation where I have to work around a proprietary solution that just doesn’t make sense for what I am trying to do, it ads a point or two to my Diastolic. So here is my dream setup:
Simple LDAP client code using deprecated API
This query returns all objects.
OpenLDAP API is somewhat hostile
After a few days beating my head against OpenLDAP’s C API, the only thing I can think is that the developers don’t want you to use it. Continue reading
Code to Convert a MAC address to IPv6
The following code will convert an ethernet MAC address to the comparable IPv6 link only address.
Interview Question for Distributed Computing
This is an updated version of my interview question, made non-bproc like.
Using only the following API:
- printf(…)
- int get_node_count() // number of compute nodes attached to the head node. 0 means no other nodes
- int get_current_node()// 0 for the head node, 1-n for the compute nodes.
- int remote_fork(int node) // like fork, but returns an fd to the child/parent process
- void send_long_sync(int fd, long value)//send and wait, blocks until receipt
- long recv_long_sync(int fd)//block until value is available
- long gettime()
Calculate the average clock skew on the cluster. Return 0 on success, and -1 on any failures.
Assume that all nodes are up and running. This is a c subset of c++. Each of these functions throw an exception upon failure. rfork has the same semantics as fork: when it returns, there are two copies of the program running, just on separate machines. The next line of code to execute will be the line immediately after the fork on both machines. However, the returned value is not a process ID, and the parent process does not need to wait for the remote process to finish: the child process is automatically reaped by init.
Faking out PAM Authentication
I am working on a server application that uses Pluggable Authentication Modules (PAM) for authentication support. This application must run as root. As part of development, people need to log in to this server. I don’t want to give out the root password of my development machine to people. My hack was to create a setup in /etc/pam.d/emo-auth that always allows the login to succeed, provided the account exists. The emo-auth configuration is what the application looks up to authenticate network connections.
$ cat /chroot/etc/pam.d/emo-auth
account  required  pam_permit.so
auth     required pam_permit.so
session  required pam_permit.so
Now people login with root, and any password will allow them to get in.
Since this is only for development, this solution works fine, and does not require any code changes.
Musings
Don’t hit publish on the blog when you just want to save a draft.
Big Builds are Bad. Software should be developed and distributed in small packages. Linux is successful due to things like apt, yum, and yast.
Interface Specifications need to be more specific. Just saying that something is a string is not really helpful if that something needs to conform to a pattern.
Programming and blogging requires sugar in the brain.
Interviews are tricky…on both sides of the table. Career fairs are worse.
C++ Has a lot of magic in it. Can we make type level programming more transparent?
Microsoft purchasing Yahoo would be good for Google, but bad for just about everyone else.
Being a Dad is really cool. Even when it sucks, it is great. Sometimes kids refuse to go to sleep. This leads to sleep deprivation, but also leads to really wonderful moments in rocking chair in the middle of the night.
Pool is a great Geek game. Lower left-hand English is neat.
Snowshoes are good off the trail. Not so good on the trail. If your going on the trail, take the cross country skis. Snowmobiles smell funny.
New Hampshire winter weather is still as brutal today as it was when I left the area in the early ’90s.
It is hard to sing a Jazzy version of Old MacDonald had a Farm. It is harder to do after the tenth repetition while trying to get a child to fall asleep.
If you listen to Children’s CDs long enough, you will develop favorite children’s songs. I like the hippo song.
Is there really a difference between the Ethernet and SCSI protocols? I don’t know, but it would be fun to find out.
The compiler is your friend. Let it check your work for you.
Why write code on a white board if you have a computer available? Especially if you have an overhead projector?
Where do the local peregrine falcons sleep? Where would they be sleeping if we hadn’t built up the whole area?
If I could have a redo on which language to take as a Sophomore, I would probably would have liked to take Chinese. Russian and Arabic would also do. German was not a good choice for me.
If Bush Senior had insisted on pushing to Baghdad, it would have been my generation in this mess as opposed to the current set of junior officers. Instead of Haiti, I would have gone to Basra or something.
There are too many interesting topics in the world to pursue them all, or even a small fraction of them.
Every philosopher I’ve read, especially the ones I disagree with, ave said something that is valuable and true.
No matter how old you are, when you get together with your parents, you revert to teenager status.
This list should never see the light of day.
High Availability and dealing with failures
Time to use my pubic forum to muddle through some design issues I’m struggling to lay straight.
A Data center is made up of several objects: Servers ( computers, usually horizontal), racks(hold the computers), switches(a network device that connects two or more computers together), power sources, and cables (both electric and network cables, to include fiber optic for storage devices). A server in the data center can serve on or more roles: storage host, computation host, administration, or user interface. If an application is hosted in a data cetner, it is usually important enough that it requires some guarantee of availability. This application will resided on a computation host, and require access to other types of hosts. An email server stores the received messages in a storage host, probably connected to the computation host via fiber optics. It receives and sends messages via a network connection that goes to the outside world. It may also talk to a User Interface machine that runs a web server and an application that allows web access to email. If the computation host loses connectivity with either the public network or the storage host, it cannot process mail. If the web server loses connectivity to the mail server, certain users cannot access their mail.
There are many reasons that connectivity can fail. The major links in the chain are: OS failure, Network interface card (NIC) failure, bad cable, disconnected cable, bad switch, unplugged switch, switch turned off. Once you pass the switch, the same set of potential problems exist on to the other host. To increase reliability, a network will often have two switches, and each server will have two NICs, one plugged into each switch. The same set up goes for storage, although different technologies are used. As a general rule, you don’t want to have things running in hot standby mode. It is a waste of resources, and it doesn’t get tested until an emergency hits. Thus, the double network connectivity usually gets set up also as a way to double bandwidth. Now if one of the cables breaks, that server merely operates in a degraded mode. The second cable has been passing network traffic already, now it just gets all of it.
A typical data center has many machines. Typical server loads are very low, sometimes in the 1-3% range of overall capacity. Thus, if a machine fails, a data center often has plenty of servers that could absorb the load from the failed server. Figuring out how to cross load services in a data center has been a major topic in the IT world over the past decade. This goes by many names, one of which is grid computing. I’ll use that term myself here. There are several problems any grid system has to solve, but most can be clumped under the term application provisioning. This means getting all of the resources together that a given application requires so that they available on the computation host. These resources include the network and storage connections described above, as well as the executables, data files, licenses, and security permissions required to run the application.
When a host fails, some remote monitoring system needs to act. First, it needs to know that the host has failed. This is typically performed through a heartbeat sensor. This is a simple network communication sent by the computation host saying “I’m still alive.” Cue Mike McCready. When a heartbeat fails, the monitor needs to make sure that the application is up online somewhere as soon as possible. Now, the reason the heartbeat failed might have been because of a problem on the heartbeat network, and the application is actually up and running just fine. An advanced solution is to test the system through some alternative method. In the case of the email server, it may be to connect to the email port and send a sample message. This delays the restart of the application, but may minimize downtime.
Sometimes, two copies of the applications can’t run at the same time. In this case, you have to be sure that the original one is gone. To achieve this, you shut off the original server. This is called “Shoot the other node in the head.” or STONITH. Sometimes the word node is replaced with guy and you get STOGITH. If you do this incorrectly, you may take yourself down, a situation referred to as SMITH. Or you take all servers down, and this is called SEITH. But I digest…
Here’s the part that I am currently trying to decide. If an application depends on a resource, and that resource fails, you can bring the application up on a different server. It will take a non-trivial amount of time (estimate it a minute) to shut down the old instance and bring up the new instance. If, on the other hand, the disconnect is temporary, we can have minimal down time by just waiting for the network to come back up. If someone disconnects a cable by accident, that person can just plug the cable back in. If the network is redundant, removing one cable may result in degraded performance, but it may not.
If the failure is due to the switch being down, just selecting another host connected to the same switch will result in downtime and a situation that is no better than the original. If the problem is the storage host being down, there probably is nothing you can do to recover outside of human or divine intervention.
If a switch goes down but there is another set of hosts on a different switch, you can migrate applications to the new host. But you may end up overloading the new switch. This is referred to as the stampeding herd effect. If the lost switch is degrading performance for all applications dependent on that switch, you best strategy is to migrate a subset of applications to balance the load. After each application is moved, recheck the network traffic to determine if you’ve done enough. Or done too much.
A malfunctioning NIC or switch might manifest in intermittent connectivity. In this case, you want to get the application off of the original server and on to a new server. The problem is in distinguishing this from the case where the cable just got unplugged once, and then plugged back in. From the server’s perspective, the network is gone, and then it is back. This leads to a a lot of questions. What interval, and how many iterations do you let go by before you decide to bail from that server? If you have redundancy, does the failing connection impact the user’s experience, or does proper routing ensure that they have seamless connectivity?
Using tcpdump to see packet contents
This particular line is for viewing 1300 bytes (or less) of each packet sent out on a multicast address 224.0.6.127 (Oh Mighty ISIS). -x and -X provide hex and ascii translation.
tcpdump -x -X -s 1300 -i eth0 -- host 224.0.6.127