Excerpts from Books and Wikipedia
"Melville began writing Moby-Dick in February 1850, and finished 18 months later, a year longer than he had anticipated. Melville drew on his experience as a common sailor from 1841 to 1844, including several years on whalers, and on wide reading in whaling literature. The white whale is modeled on the notoriously hard-to-catch albino whale Mocha Dick, and the book's ending is based on the sinking of the whaleship Essex in 1820. The detailed and realistic descriptions of whale hunting and of extracting whale oil, as well as life aboard ship among a culturally diverse crew, are mixed with exploration of class and social status, good and evil, and the existence of God. The book's literary influences include Shakespeare and the Bible. In addition to narrative prose, Melville uses styles and literary devices ranging from songs, poetry, and catalogs to Shakespearean stage directions, soliloquies, and asides. In August 1850, with the manuscript perhaps half finished, he met Nathaniel Hawthorne and was deeply impressed by his Mosses from an Old Manse, which he compared to Shakespeare in its cosmic ambitions. This encounter may have inspired him to revise and deepen Moby-Dick, which is dedicated to Hawthorne, 'in token of my admiration for his genius.'" [Wikipedia]