How to export comments?
The best way to migrate content is the Migrate module, in the module page you can find many Case studies with code inside and in the documentation page you will find all the information that you need.

Inside the Migrate module folder you can find the Beer.inc file, which is an example of how you can do simple mappings. For more complicated migrations you can look into Wine.inc.