John nailed it...but the problem is...
The cheaper marine water heaters used by many production boat builders don't have sacrifical anodes...the inner tank isn't glass, it's anodized alumium...and when the anodizing is eaten away, there's nothing that can be done except replace the whole water heater.Anodes are included in the water heater of better quality--and household--glass-lined steel tanks to protect the inside of the tank against corrosion from acids in the water, stray electrical currents, etc. Glass lined tanks, when the water heater is being built, are heated up red hot. Then glass powder is sprayed inside the tank and it adheres upon contact. However, it doesn't cover every single crack and crevice inside the tank - it should, but in actual practice, it doesn't. The purpose of the anode is to protect those spots inside the tank that have not been glass-covered from rusting away prematurely. The anode is eaten away, rather than the tank being eaten away. Kind of a backup to the glass lining.The anode is a magnesium rod, about 3/4" in diameter that is attached to the inside of the hot water "out" nipple, via a plastic coupling. It is electrically isolated from the fittings and from the tank. It extends all the way across the inside of the tank, stopping just short of the other side. There is an iron rod in the center of the magnesium that supports it, the iron being stronger than the magnesium. As the magnesium is eaten away and the iron rod exposed, there's a chemical reaction between the water, the iron and the magnesium that causes the "rotten egg" smell. Replacing the anode and flushing out the tank will usually make the foul smell go away.