
Remove rust with a wire brush and steel wool. Paint with Rustoleum. Then fill pit with caulk and slope it away from post. Otherwise you'll need to hire a welder or replace the whole railing.
This is a good option for a metal railing on a wood deck or a replacement for ones that have broken in concrete. No welding required! Click on image for link.

These plastic caps will prevent the bolts from rusting.