A data synchronization method and apparatus, a computer device and a storage medium are applied to a data synchronization system comprising a database, a first server and a second server, and the method comprises: in response to a change of configuration information of the data synchronization system, obtaining target configuration information of the data synchronization system; according to the target configuration information, determining a to-be-locked first data queue from at least one data queue running on the first server, and determining a to-be-locked first database from all databases; sending a locking request to a second server, so that the second server creates a first resource corresponding to the first data queue in a first resource pool of the first database; and obtaining the resource information of the first resource pool from the second server to judge whether the locking is successful, if the locking is successful, connecting the first data queue with the first database, otherwise, performing change monitoring on the first resource pool, thereby dynamically adjusting the connection between the data queue on the first server and the database, and reducing the operation and maintenance difficulty of the system.