Step 1: Connect to member and check the current configuration

rs.conf()

Step 2: Save the current configuration to another variable.

x = rs.conf()

Step 3: Select the id,host and port of the member that is to be made as primary.

x.members = [{"_id":1,"host" : "localhost.localdomain:27071"}]

Step 4: Reconfigure them by force.

rs.reconfig(x, {force:true})

Source: https://stackoverflow.com/questions/8214159/how-do-i-force-a-secondary-to-be-a-primary-when-priority-0-and-slavedelay