Here is how one can prove that the number of components is at most $2$ in the case of complex projective surfaces. So let $X$ be such a surface and let $D_1\cup \ldots\cup D_k$ be a smooth anti-canonical divisor with $k>0$.

(i) Since $-K_X$ is effective, we see that $X$ has Kodaira dimension $-\infty$. I.e. it is either a rational surface or an irrational ruled surface.

(ii) All components $D_i$ are elliptic curves (by adjunction formula, for example).

(iii) Suppose first that we are in the irrational ruled case and let $F$ be a fiber. Since through every point of $X$ a fiber passes, and all $D_i$'s are ellipitic curves, we see that $D_i\cdot F>0$. At the same time $D\cdot F=-K_X\cdot F=2$. So we have at most two divisors $D_i$.

(iv) Suppose now we are in the rational case. Then either $X$ is $\mathbb CP^2$ and $D$ is a smooth elliptic curve or again $X$ admits the structure of a $\mathbb CP^1$ fibration (over $\mathbb CP^1$), where we can reason as in (iii).

**Case of higher dimension?** What follows is speculative, since my Mori theory knowledge is close to zero. It seems to me that the above reasoning has chances to succeed in higher dimensions as well. At least, in case $X$ is a Mori fiber space, it looks to me that $D$ cuts out on a generic (Mori) fiber a divisor in the anti-canonical class with the same number of components. So we might proceed by induction.

areon the cubic I get turned around. But I'm guessing you've already thought of this and I'm wrong, hence the need for the question, because otherwise you can achieve any $k$ by blowing up $k-1$ points. But I thought I should mention this anyway, just in case. $\endgroup$ – Tabes Bridges May 1 at 6:35