Pseudorapidity (eta) distributions of charged particles produced in proton-proton collisions at a centre-of-mass energy of 8 TeV are measured in the ranges abs(eta) < 2.2 and 5.3 < abs(eta) < 6.4 covered by the CMS and TOTEM detectors, respectively. The data correspond to an integrated luminosity of 45 inverse microbarns. Measurements are presented for three event categories. The most inclusive category is sensitive to 91-96% of the total inelastic proton-proton cross section. The other two categories are disjoint subsets of the inclusive sample that are either enhanced or depleted in single diffractive dissociation events. The data are compared to models used to describe high-energy hadronic interactions. None of the models considered provide a consistent description of the measured distributions.