Due to the advances of wireless sensor networks, radiofrequency identification (RFID) and Web-based services, large volume of devices have been interconnected to the Internet of Things (IoT). In addition, the tremendous number of IoT services provided by service providers arises an urgent need to propose effective recommendation methods to discover suitable services to users. In this paper, we propose an online learning system for IoT service recommendation based on a contextual multi-armed bandit algorithm. Our system learns online probably useful services for users which are not known by them based on context (e.g. spatiotemporal information, users type, device settings, etc.). We cluster services and contexts online as tree structures for computational efficiency. This approach significantly improves recommendation accuracy compared to other IoT recommendation algorithms and bandit approaches. Fusing the user-centered context with service-centered context, the system addresses the cold start problem and performs well even when users and services are in large scale. Furthermore, experiments based on massive dataset prove that our system achieves sublinear regret in the long-run and reduces the storage complexity to sublinear level, which means our algorithm provides online big data support. The experiments perfectly validate our theoretical analysis.