2. Given $f(x)=\lg (x+1)-\frac{1}{2} \log _{3} x$. Then the set
$$
M=\left\{n \mid f\left(n^{2}-8 n-2018\right) \geqslant 0, n \in \mathbf{Z}\right\}
$$

the number of subsets of $M$ is $\qquad$.
2. 1.

For any $0< x_2 < x_1$, we have
$$
\begin{array}{l}
f\left(x_{1}\right)-f\left(x_{2}\right)=\lg \frac{x_{1}}{x_{2}}-\frac{\lg \frac{x_{1}}{x_{2}}}{\lg 9}>0 .
\end{array}
$$

Thus, $f(x)$ is a decreasing function on the interval $(0,+\infty)$. Note that, $f(9)=0$.
Therefore, when $x>9$, $f(x)f(9)=0$.
Hence, $f(x)=0$ has and only has one root $x=9$.
From $f\left(n^{2}-8 n-2018\right) \geqslant 0$
$$
\Rightarrow 0<n^{2}-8 n-2018 \leqslant 9
$$
$\Rightarrow n$ has no integer solutions.
Thus, $M=\varnothing$, and the number of subsets of $M$ is 1.