The microbiota - the collection of microorganisms that live within and on all mammals - provides crucial signals for the development and function of the immune system. Increased availability of technologies that profile microbial communities is facilitating the entry of many immunologists into the evolving field of host-microbiota studies. The microbial communities, their metabolites and components are not only necessary for immune homeostasis, they also influence the susceptibility of the host to many immune-mediated diseases and disorders. In this Review, we discuss technological and computational approaches for investigating the microbiome, as well as recent advances in our understanding of host immunity and microbial mutualism with a focus on specific microbial metabolites, bacterial components and the immune system.