Born into an impoverished family of distinguished Dutch and English colonial descent, Melville was 12 when his father died. He left school at 15, worked at a variety of jobs, and in 1839 signed on as a cabin boy on a ship bound for Liverpool, an experience reflected in his romance Redburn. In 1841–42 he spent 18 months on a whaler, but intolerable hardships on board caused him and a companion to escape from the ship at the Marquesas Islands. The two were captured by a tribe of cannibals, by whom they were well treated. After being rescued by an Australian whaler, Melville spent some time in Tahiti and other Pacific islands before shipping home in 1844.
The immediate results of his experiences were Typee: A Peep at Polynesian Life (1846), Omoo: A Narrative of Adventures in the South Seas (1847), as well as Redburn (1849), all fresh, exuberant, and immensely popular romances. In 1847, Melville married Elizabeth Shaw, the daughter of Lemuel Shaw, chief justice of Massachusetts. The popularity of his books brought him prosperity, business trips to Europe, and admission to literary circles in New York City. In 1850 he bought a farm near Pittsfield, Mass., and became friends with his neighbor Nathaniel Hawthorne. The allegorical implications evident in his romances Mardi: and a Voyage Thither (1849) and White-Jacket; or, The World in a Man-of-War (1850) reached full development in Melville's masterpiece, Moby-Dick; or, The Whale (1851).