A gunman shot and wounded several people at a synagogue in San Diego as worshippers prayed on the last day of Passover, police said.