The detector sets generated by Real-Valued Negative Selection Algorithm (RNSA) are usually numerous, without optimization, and can not work under real-time condition. Thus, a novel approach of detector generation for RNSA based on Clonal Selection and Neighborhood Search (CSNS-RNSA) is proposed. Clonal selection of the immune mechanism is introduced to implement global search in a quasi-random sequence. The Gaussian mutation operator is proposed to get the global optimal detection sets of N-dimensional space through Neighborhood search. The resulting detector sets achieved a good coverage of non-self space, and also significantly reduced the number of detector sets, thus overcome the limitations of original RNSA. Finally, experiments verify the effectiveness of the algorithm.