The remainder of the island , by then known as Santo Domingo , sought to gain its own independence in 1821 but was conquered and ruled by the Haitians for 22 years ; it finally attained independence as the Dominican Republic in 1844 .