The invention discloses a method for generating an unique ID in a distributed system, related to the field of distributed systems. The method for generating the unique ID in the distributed system is characterized by performing segmented assignment on the ID and storing the APPID of the host, the IP address of the host, the timestamp, and the time self-increasing sequence respectively. The generation speed is fast caused by the shift stitching of different data modules; and the required business information can be carried, therefore, the acquisition and distribution of the information can be easily performed among the distributed systems. According to the method for generating the unique ID in the distributed system, the communication with any external storage devices is not performed in the process of generating the ID, therefore, the possibility of errors is greatly reduced, and the generation process is accelerated; the generation of the ID is based on the timestamp, therefore, the generated ID is monotonic and ordered; and the APPID, IP, millisecond time and sequence number in milliseconds are stitched, therefore, the extension can be performed in the whole IP range, and the requirement of applying the distributed deployment more is greatly met.