The world's largest commodities trader Glencore has agreed to buy mining giant Xstrata to create a global giant in coal, zinc and copper mining and production.