Open peer-to-peer architectures offer many possibilities for replicating database content, but designers have to deal with problems such as peer churn rates and inherent uncertainty in decision making. The lack of global knowledge of peer characteristics poses the specific problem of reliable peer discovery for database replica placement. This paper describes a self-organising algorithm for generating a peer-to-peer gradient topology that helps to solve the problem of replica placement through the clustering of peers with similar uptime and performance characteristics. We evaluate the algorithm by simulation, and propose an approach for master-slave replication that exploits the properties of the presented topology.