In general, the scheduler will do a pretty good job of this without any help. In the wild, I've only seen one situation where this mattered....
We were deploying a node service on an 8-core box and during load testing we made the strangest observation... the service actually performed better with 7 workers than with 8. A bit of debugging later and we figured out that all network interrupts were being handled by core 0. I played with using 15 workers so that core0 would have a 1/2 share of the load compared to the other cores. Ultimately, I think we ended up going with 7 workers because it was simpler and more predictable and the complexity just wasn't worth it to get ~7% more theoretic throughput.
That being said, to set CPU affinity on linux:
$ taskset -pc 3089
pid 3089's current affinity list: 0,1
$ taskset -p 3089
pid 3089's current affinity mask: 3 # core 0 = 0x1, core 1 = 0x2
$ taskset -pc 1,2,3 3089
pid 3089's current affinity list: 0,1
pid 3089's new affinity list: 1