Distributed data centers (DDCs) consume power energy increasingly to provide different types of heterogeneous services to global consumers. Consumers bring revenue to DDC providers according to actual quality of service (QoS) of their requests. High energy consumption caused by a DDC is paramount for its providers to solve. During the maintenance due to failures, network service providers have to guarantee continuously reliable services to their consumers to ensure their revenues. Therefore, it is highly challenging to schedule tasks among DDCs in a low-energy and high-QoS way. In this paper, we propose a novel hierarchical framework for solving the task scheduling and power management problem in DDCs. The proposed hierarchical framework comprises: (1) a tier for global task scheduling to the DDCs and (2) a local tier for distributed power management of local servers. The dataset transmission energy between DDCs is considered. Meanwhile, this approach optimizes three conflicting objectives: total cost, energy consumption during computations and transmissions, and application rejections or violations due to failures. The proposed method can also improve resource utilization. The experimental simulations on large scale parallel working datasets show that this method can save energy significantly and obtain high quality of service. Meanwhile, it can achieve a good trade-off between QoS and energy consumption in DDCs.